We present a detailed study of the kinematics of M dwarfs in the CARMENES (Calar Alto high-Resolution search for M dwarfs with Exoearths with Near-infrared and optical Échelle Spectrographs) input catalog. We have selected all M dwarfs with known parallactic distance or a good photometric distance estimation, precise proper motion in the literature or as determined by us, and radial velocity measurements. Using these parameters, we computed the M dwarfs galactic space motions (U, V, W). For the stars with U and V velocity components inside or near the boundaries that determine the young disk population, we have analyzed the possible membership in the classical moving groups and nearby loose associations with ages between 10 and 600 Myr. For the candidate members, we have compiled information available in the literature in order to constrain their membership by applying other age-dating methods.