Suppose \(g\) is not a constant function on \([a, b]\text{.}\) Then there exists some \(c\in (a, b)\) such that \(|g(c)-g(a)| > 2\epsilon\) for some \(\epsilon > 0\text{.}\) Consider \(E_{c} :=\{x\in (a, c): g'(x)=0\}\text{.}\) Then \([a, c]\setminus E_{c}\) is negligible. For any \(x\in E_{c}\) and any \(r > 0\text{,}\) for all sufficiently small \(h > 0\text{,}\) we have \([x, x+h]\subset (a, c)\) and
\begin{equation*}
|g(x+h)-g(x)|\le r h.
\end{equation*}
Thus for any fixed such \(r > 0\text{,}\) the family \(\{[x, x+h]: x\in E_{c}\}\) forms a Vitali cover of \(E_{c}\text{.}\) Thus, for any \(\delta > 0\text{,}\) there exists disjoint intervals
\begin{equation*}
[x_{1}, x_{1}+h_{1}], \cdots, [x_{k}, x_{k}+h_{k}]
\end{equation*}
such that
\begin{equation*}
[a, c] \setminus \cup_{i=1}^{k} [x_{i}, x_{i}+h_{i}]
\subset \left([a, c]\setminus E_{c}\right) \cup \left( E_{c}\setminus \cup_{i=1}^{k} [x_{i}, x_{i}+h_{i}]\right)
\end{equation*}
can be covered by an open set \(G\) with \(|G| < \delta\text{.}\)
We may assume that
\begin{equation*}
a < x_{1} < x_{1}+h_{1} < x_{2} < x_{2}+h_{2} < \cdots < x_{k} < x_{k}+h_{k} < c.
\end{equation*}
These points, together with \(a \) and \(c\text{,}\) forms a partition of \([a, c]\text{.}\) The sum of the lengths of those intervals of this partition not-overlapping with any of \((x_{i}, x_{i}+h_{i})\) is \(< \delta\text{.}\) Then
\begin{equation*}
2\epsilon < |g(c)-g(a)| \le \sum_{i=1}^{k} |g(x_{i})-g(x_{i}+h_{i})| + \sum_{i=0}^{k} |g(x_{i}+h_{i})-g(x_{i+1})|
\end{equation*}
where we set \(x_{0}+h_{0}=a\) and \(x_{k+1}=c\text{.}\)
We fix \(r > 0\) such that \(r(b-a) < \epsilon\text{.}\) Using the absolute continuity of \(f\) on \([a, b]\text{,}\) there exists some \(\delta > 0\) such that for any collection of disjoint intervals \([a_{j}, b_{j}]\) with \(\sum_{j} (b_{j}-a_{j}) < \delta\text{,}\) we have \(\sum_{j}|g(b_{j})-g(a_{j})| < \epsilon\text{.}\) For this reason, \(\sum_{i=0}^{k} |g(x_{i}+h_{i})-g(x_{i+1})| < \epsilon\text{.}\) But
\begin{equation*}
\sum_{i=1}^{k} |g(x_{i})-g(x_{i}+h_{i})| \le \sum_{i=1}^{k}r h_{i} \le r(b-a) < \epsilon.
\end{equation*}
We now see a contradiction and must conclude that \(g\) is a constant function on \([a, b]\)