The long-standing problem of the asymmetry between matter and antimatter in the Universe is, in this paper, analysed in the context of the modified theories of gravity. In particular we study two models of f (R) theories of gravitation that, with the opportune choice of the free parameters, introduce a little perturbation to the scale factor of the Universe in the radiation dominated (RD) phase predicted by general relativity (GR), i.e., a(t) ∼ t 1/2 . This little perturbation generates a Ricci scalar different by zero, i.e., R = 0 that reproduces the correct magnitude for the asymmetry factor η computed in the frame of the theories of the gravitational baryogenesis and gravitational leptogenesis. The opportune choice of the free parameters is discussed in order to obtain results coherent with experimental data. Furthermore, the form of the potential V , for the scalar-tensor theory conformally equivalent to the f (R) theory which reproduces the right asymmetry factor, is here obtained.