By assuming the kinetic coupling f2(ϕ)FF of the effective inflaton field ϕ with the electromagnetic field, we explore magnetogenesis during the inflation and preheating stages in the Starobinsky model. We consider the case of the exponential coupling function f(ϕ)=exp(αϕ/Mp) and show that for α∼12−15 it is possible to generate the large scale magnetic fields with strength ≳10−15 Gauss at the present epoch. The spectrum of generated magnetic fields is blue with the spectral index n=1+s, s>0. We have found that for the relevant values of the coupling parameter, α=12−15, model avoids the back-reaction problem for all relevant modes.