The scalaron of the metric f (R) gravity can constitute dark matter if its mass is in the range 4 meV m 1 MeV. We give an overview of such f (R) gravity theory minimally coupled to the Standard Model. Similarly to other darkmatter models based on scalar fields, this model has the issue of initial conditions. Firstly, the initial conditions for the scalaron are to be tuned in order to produce the observed amount of dark matter. Secondly, the primordial spatial inhomogeneities in the field are to be sufficiently small because they generate entropy (or isocurvature) perturbations, which are constrained by observations. We consider these issues in the present paper. The initial conditions for the scalaron presumably emerge at the inflationary stage. We point out that the homogeneous part of the scalaron initial value is largely unpredictable because of quantum diffusion during inflation. Thus, to account for the observed amount of dark matter, one has to resort to anthropic considerations. Observational constraints on the primordial spatial inhomogeneity of the scalaron are translated into upper bounds on the energy scale of inflation, which happen to be rather weak.