Properties of the motion of an electron with relativistic energy entering an arbitrary Hmn-mode wave in a rectangular waveguide are considered. The derivation of the averaged motion is performed using the Krylov-Bogolyubov averaging method. The ratio of the amplitude of the quiver velocity of the particle in the wavefield to the speed of light is considered as the small parameter. The averaged equations of motion and the periodic additions to the smoothed variables are obtained up to second-order expansions over the small parameter. It is shown that the averaged (ponderomotive) force along the longitudinal axis of the waveguide is absent independent of the wave mode. Numerical solutions of both exact and averaged systems of equations are obtained, demonstrating an excellent agreement of the models. The importance of the correct setting of the initial conditions for the averaged equations based on the values of the periodic additions is emphasized. The conditions, under which the effect of reflection or refraction of the electron by the waveguide field takes place, are established in the case when the electron is injected transversely. © 2021 Author(s).