This paper deals with the study of propagation of electromagnetic wave in a rectangular waveguide filled with an inhomogeneous plasma in which electron density varies linearly in a transverse direction to the mode propagation. A transcendental equation in ω (microwave frequency) is obtained that governs the mode propagation. In addition, an attempt is made to examine the effect of density inhomogeneity on the energy gain acquired by the electron (electron bunch) when it is injected in the waveguide along the direction of the mode propagation. On the basis of angle of deflection of the electron motion we optimize the microwave parameters so that the electron does not strike with the waveguide walls. Conditions have been discussed for achieving larger energy gain. The plasma density inhomogeneity is found to play a crucial role on the cutoff frequency, fields and dispersion relation of the TE10 mode as well as on the acceleration gradient in the waveguide.