There's a constructive proof of this fact (which uses dependent choice), though it can easily be altered into a non-constructive proof which does not use dependent choice.
Suppose given $a \leq b$ and $f: (a, b) \to \mathbb{R}$ which is differentiable on $(a, b)$, and suppose that for all $x \in (a, b)$, $f'(x) = 0$. Take $c, d \in (a, b)$ such that $c < d$. We will show that $f(c) \geq f(d)$.
Proof: We note that $f(c) \geq f(d)$ iff it is not the case that $f(c) < f(d)$ - this is true constructively. Suppose now that $f(c) < f(d)$.
We will construct a sequence of pairs $\{(c_i, d_i)\}_{i = 0}^\infty$ such that for all $i \in \mathbb{N}$, $f(d_i) > f(c_i) + (f(d) - f(c)) / 2^{i+1}$; furthermore, $\{c_i\}$ will be monotonically increasing sequence while $\{d_i\}$ will be monotonically decreasing, and we will have $d_i = c_i + (d - c) 2^{-i}$.
Define $c_0 = c$ and $d_0 = d$. Then we have $c \leq c_0 \leq d_0 \leq d$, and we have $f(d) > (f(d) + f(c))/2$ and therefore $d_0 > c_0 + (d - c)/2$; and clearly, we have $d_0 = c_0 + (d - c) / 2^0$. Now suppose we have $c_i$ and $d_i$ satisfying the above properties. Then we have $f(c_i) + (f(d) - f(c)) / 2^{i+2} < f(d_i) - (f(d) - f(c)) / 2^{i + 2}$. Let $m = (c_i + d_i) / 2$. By the locatedness property of Dedekind cuts, we either have $f(m) > f(c_i) + (f(d) - f(c)) / 2^{i+2}$ or $f(m) < f(d_i) - (f(d) - f(c)) / 2^{i + 2}$. Using dependent choice, we either choose $(c_{i + 1}, d_{i + 1}) = (c_i, m)$ in which case $f(m) > f(c_i) + (f(d) - f(c)) / 2^{i + 2}$, or we choose $(c_{i + 1}, d_{i + 1}) = (m, d_i)$ in which case $f(m) < f(d_i) + (f(d) - f(c)) / 2^{i + 2}$; in either case, we have $d_i = c_i + (d - c) / 2^{i + 1}$; and we have $f(d_{i + 1}) > f(c_{i + 1}) + (f(d) - f(c)) / 2^{i + 2}$; and we have $c_i \leq c_{i + 1}$ and $d_i \geq d_{i + 1}$.
Now the $c_i$ and $d_i$ are clearly Cauchy sequences which converge to the same value; call the limit $x$. We see that $c \leq x \leq d$; then $x \in (a, b)$; then $f'(x) = 0$. Then $\lim\limits_{h \to x} \frac{f(h) - f(x)}{h - x} = 0$. This implies that for all $\epsilon$, there is some $\delta$ such that for all $h \in (x - \delta, x + \delta)$, $|f(h) - f(x)| \leq \epsilon |h - x|$ and therefore, for all $h_1 \in (x - \delta, x]$ and $h_2 \in [x, x + \delta)$, $|f(h_2) - f(h_1)| \leq \epsilon (h_2 - h_1)$. But now set $\epsilon = \frac{f(d) - f(c)}{2(d - c)}$ and take an appropriate $\delta$. Take $i$ such that $c_i \in (x - \delta, x]$ and $d_i \in [x, x + \delta)$. Then $f(d_i) - f(c_i) > \frac{f(d) - f(c)}{2^{i + 1}} = \epsilon \frac{d - c}{2^i} = \epsilon (d_i - c_i)$. Contradiction. Then it cannot be the case that $f(c) < f(d)$; then $f(c) \geq f(d)$.
The same argument shows that $f(c) \leq f(d)$. Therefore, whenever $c < d$, we have $f(c) = f(d)$.
Finally, take arbitrary $x, y \in (a, b)$. Then $a < x$ and $a < y$. Take rational numbers $r \in (a, x)$ and $p \in (a, y)$; let $w = \min(r, p)$. Then $w < x$ and $w < y$. Then $f(w) = f(x)$ and $f(w) = f(y)$; then $f(x) = f(y)$. Then $f$ is constant. QED.