Solution (source code)

= Solution

At the initially vertical configuration, the two conserved momenta coincide:
$$
\boxed{p_\phi(t)=p_\psi(t)=I_3\omega,\qquad
H(t)=\frac{I_1\omega_0^2}{2}+\frac{I_3\omega^2}{2}+mga.}
$$
The apparent $0/0$ angular term at $\theta=0$ is interpreted by its regular limit with these equal momenta. Substitution into <energy> conservation, followed by $1-\cos\theta=2\sin^2(\theta/2)$, gives
$$
\omega_0^2=\dot\theta^2+
\frac{I_3^2\omega^2}{I_1^2}\tan^2\frac\theta2
-\frac{4mga}{I_1}\sin^2\frac\theta2.
$$
Writing $C=I_3\omega/I_1$ yields
$$
\boxed{V(\theta)=C^2\sin^2\frac\theta2\left[\sec^2\frac\theta2-\alpha\right],\qquad
\alpha=\frac{4mgaI_1}{I_3^2\omega^2}.}
$$
The zero of the potential at the vertical configuration includes the initially specified transverse <kinetic energy> separately as $\omega_0^2$.