  We construct a non-trivial $U(1)/\mathbb{Z}_q$ principal bundle on~$T^4$ from
the compact $U(1)$ lattice gauge field by generalizing L\"uscher's constriction
so that the cocycle condition contains $\mathbb{Z}_q$ elements (the 't~Hooft
flux). The construction requires an admissibility condition on lattice gauge
field configurations. From the transition function so constructed, we have the
fractional topological charge that is $\mathbb{Z}_q$ one-form gauge invariant
and odd under the lattice time reversal transformation. Assuming a rescaling of
the vacuum angle $\theta\to q\theta$ suggested from the Witten effect, our
construction provides a lattice implementation of the mixed 't~Hooft anomaly
between the $\mathbb{Z}_q$ one-form symmetry and the time reversal symmetry in
the $U(1)$ gauge theory with matter fields of charge~$q\in2\mathbb{Z}$ when
$\theta=\pi$, which was studied by Honda and Tanizaki [J. High Energy Phys.
\textbf{12}, 154 (2020)] in the continuum framework.
