Dorset Council has agreed to buy Middle Farm at Higher Kingcombe, which sits alongside a Dorset Wildlife Trust (DWT) nature reserve.
The council said changing its use to woodland or rewilding the area would reduce harmful nutrients flowing from the farm into watercourses.
The exact purchase price of the farm has not been disclosed, although the council has received a £4.63m grant from central government.
The authority has not confirmed whether the cost is higher or lower than the grant total.
In a statement, it said the current intensive use as a dairy farm was “not ideal” as it suffered from run-off and soil erosion.
“The land is ideally located to deliver both nutrient reduction and nature recovery in the headwaters of the River Hooke.
“Changing its use to woodland or rewilding can reduce nitrates as required and could be achieved with little investment,” it said.
The sale was approved by the former Conservative administration and is continuing after the Liberal Democrats took control of the council following the local elections.
Dorset Council said it was supported by Natural England and that there had been discussions with DWT, which runs the adjacent Kingcombe National Nature Reserve.