It's harder, but if one looks at the externalities from fossil fuel consumption, it's actually cheaper to use renewable energy now.
Hydrogen for ammonia production is very cheaply storable (underground, like natural gas is stored) and would provide a large dispatchable demand to ease integration of renewables into the economy, smoothing over long timescale intermittency.
In any case, because the energy used for agriculture is so relatively small, if the economy as a whole can get off fossil fuels, agriculture certainly can as well.
Since neither the general economy nor agriculture has gotten anywhere near getting off fossil fuels yet, that is assuming a lot isn’t it?
Even if electrical grid needs are 100% renewable, that is just a couple percent of most economies energy usage.