[proofplan]
We shrink $U$ to a simply connected coordinate neighbourhood and use flatness to make parallel transport path-independent there. Starting from one point in one fibre, we define a local section by parallel transport from that point. Path-independence and smooth dependence of horizontal lifts make this section smooth, and path-independence also shows that every tangent vector to the section is horizontal. Therefore the pullback of the connection form along this section is zero.
[/proofplan]
[step:Shrink to a simply connected neighbourhood and use flatness]
Let $\mathfrak g$ denote the Lie algebra of $G$, and let $\omega\in\Omega^1(P;\mathfrak g)$ denote the given smooth connection form on $P$. Choose a point $x_0\in U$. After shrinking $U$ around $x_0$, assume that $U$ is a simply connected coordinate ball and that the given trivialisation is still defined on $U$. Let
\begin{align*}
s:U\to P
\end{align*}
be the local section determined by this trivialisation, and let
\begin{align*}
\omega\in\Omega^1(P;\mathfrak g)
\end{align*}
denote the given smooth principal connection form. Define
\begin{align*}
A:=s^*\omega\in\Omega^1(U;\mathfrak g)
\end{align*}
to be the local connection form in the section $s$. The hypothesis $F_A=0$ says that the curvature of the pulled-back connection over $U$ vanishes. Hence parallel transport for this connection along smooth paths in $U$ is invariant under smooth homotopies with fixed endpoints.
Because $U$ is simply connected, any two smooth paths in $U$ with the same endpoints are smoothly homotopic relative to endpoints after the usual smoothing of piecewise smooth paths in a coordinate ball. Therefore parallel transport between two fixed points of $U$ depends only on the endpoints.
[/step]
[step:Define the horizontal section by parallel transport]
Choose a point
\begin{align*}
p_0\in P_{x_0}.
\end{align*}
For each $x\in U$, choose a smooth path
\begin{align*}
c_x:[0,1]\to U
\end{align*}
with $c_x(0)=x_0$ and $c_x(1)=x$. Define
\begin{align*}
\sigma:U\to P
\end{align*}
by
\begin{align*}
\sigma(x):=\operatorname{PT}_{c_x}(p_0),
\end{align*}
where $\operatorname{PT}_{c_x}:P_{x_0}\to P_x$ denotes parallel transport along $c_x$. The path-independence from the previous step shows that $\sigma(x)$ is independent of the chosen path $c_x$.
The map $\sigma$ is smooth. Indeed, in a coordinate ball one may choose the paths $c_x$ smoothly in $x$, for example by taking straight coordinate segments from $x_0$ to $x$. Horizontal lifting is the solution of a smooth ordinary differential equation on the local trivialisation, so the endpoint $\operatorname{PT}_{c_x}(p_0)$ depends smoothly on $x$.
[/step]
[step:Show that the constructed section is horizontal]
We prove that the image of $\sigma$ is tangent to the horizontal distribution. Let $x\in U$, let $X\in T_xM$, and choose a smooth curve
\begin{align*}
\gamma:(-\varepsilon,\varepsilon)\to U
\end{align*}
such that $\gamma(0)=x$ and $\dot\gamma(0)=X$. By path-independence, the point $\sigma(\gamma(t))$ can be computed by first transporting $p_0$ to $\sigma(x)$ along any path from $x_0$ to $x$, and then transporting $\sigma(x)$ along the short path
\begin{align*}
r\mapsto \gamma(r)
\end{align*}
from $0$ to $t$. Thus the curve
\begin{align*}
t\mapsto \sigma(\gamma(t))
\end{align*}
is the horizontal lift of $\gamma$ through $\sigma(x)$. Consequently its velocity at $t=0$ is horizontal:
\begin{align*}
d\sigma_x(X)\in\ker(\omega_{\sigma(x)}).
\end{align*}
Since $x$ and $X$ were arbitrary,
\begin{align*}
\omega_{\sigma(x)}(d\sigma_x(X))=0
\end{align*}
for every $x\in U$ and every $X\in T_xM$.
[guided]
The section $\sigma$ was defined by transporting $p_0$ from $x_0$ to each point $x$. To show that the local connection form in this section is zero, we must show that moving the base point infinitesimally moves $\sigma(x)$ in a horizontal direction.
Fix $x\in U$ and $X\in T_xM$. Choose a smooth curve
\begin{align*}
\gamma:(-\varepsilon,\varepsilon)\to U
\end{align*}
with
\begin{align*}
\gamma(0)=x
\end{align*}
and
\begin{align*}
\dot\gamma(0)=X.
\end{align*}
For small $t$, the point $\sigma(\gamma(t))$ is defined by parallel transport from $p_0$ to the point $\gamma(t)$. Because the connection is flat on the simply connected neighbourhood $U$, parallel transport depends only on endpoints. Therefore we may compute the same point in two stages: first transport $p_0$ to $\sigma(x)$, and then transport $\sigma(x)$ along the curve segment from $x$ to $\gamma(t)$.
This means the curve
\begin{align*}
t\mapsto \sigma(\gamma(t))
\end{align*}
is precisely the horizontal lift of the base curve $\gamma$ starting at $\sigma(x)$. By definition of horizontal lift, its tangent vector at $t=0$ lies in the horizontal subspace:
\begin{align*}
\frac{d}{dt}\Big|_{t=0}\sigma(\gamma(t))\in\ker(\omega_{\sigma(x)}).
\end{align*}
The chain rule identifies this derivative with
\begin{align*}
d\sigma_x(X).
\end{align*}
Hence
\begin{align*}
\omega_{\sigma(x)}(d\sigma_x(X))=0.
\end{align*}
Since $X\in T_xM$ was arbitrary, every tangent vector to the image of $\sigma$ is horizontal.
[/guided]
[/step]
[step:Conclude that the local connection form vanishes]
The local connection form determined by the section $\sigma$ is
\begin{align*}
A_\sigma:=\sigma^*\omega\in\Omega^1(U;\mathfrak g).
\end{align*}
For every $x\in U$ and $X\in T_xM$, the previous step gives
\begin{align*}
(A_\sigma)_x(X)=\omega_{\sigma(x)}(d\sigma_x(X))=0.
\end{align*}
Therefore
\begin{align*}
A_\sigma=0
\end{align*}
on the simply connected coordinate neighbourhood $U$. This is the required local gauge in which the connection form is zero.
[/step]