We study the f(R) theory of gravity in an anisotropic metric and its effect on the baryon number-to-entropy ratio. The mechanism of gravitational baryogenesis based on the CPT-violating gravitational interaction between derivative of the Ricci scalar curvature and the baryon-number current is investigated in the context of the f(R) gravity. The gravitational baryogenesis in the Bianchi type I (BI) Universe is examined. We survey the effect of anisotropy of the Universe on the baryon asymmetry from the point of view of the f(R) theories of gravity and its effect on (Formula presented.) for radiation dominant regime.