  The CREMA collaboration is pursuing a measurement of the ground-state
hyperfine splitting (HFS) in muonic hydrogen ($\mu$p) with 1 ppm accuracy by
means of pulsed laser spectroscopy. In the proposed experiment, the $\mu$p atom
is excited by a laser pulse from the singlet to the triplet hyperfine
sub-levels, and is quenched back to the singlet state by an inelastic collision
with a H$_2$ molecule. The resulting increase of kinetic energy after this
cycle modifies the $\mu$p atom diffusion in the hydrogen gas and the arrival
time of the $\mu$p atoms at the target walls. This laser-induced modification
of the arrival times is used to expose the atomic transition. In this paper we
present the simulation of the $\mu$p diffusion in the H$_2$ gas which is at the
core of the experimental scheme. These simulations have been implemented with
the Geant4 framework by introducing various low-energy processes including the
motion of the H$_2$ molecules, i.e. the effects related with the hydrogen
target temperature. The simulations have been used to optimize the hydrogen
target parameters (pressure, temperatures and thickness) and to estimate signal
and background rates. These rates allow to estimate the maximum time needed to
find the resonance and the statistical accuracy of the spectroscopy experiment.
