WILLISTON, N.D.—For most of the years since wildcatters began tapping the prairies here for oil, energy companies have existed peacefully with the farmers and ranchers who still dominate the state’s economy.

But now a dispute has broken out between the two groups over pipeline spills, not of oil but of salty wastewater. The latest such leak came last week, when some 220,000 gallons of brine leaked on an Indian reservation. In particular, agricultural interests are frustrated that oil drillers and pipeline companies haven’t agreed to use technology that farmers say could quickly detect brine leaks.

“There’s probably nothing more toxic to land than salt water,” said Troy Coons, a farmer and chairman of the Northwest Landowners Association, an agriculture group. Farmers don’t want to stop oil production, he says, noting that many receive payments for wells on their land, but want tighter rules to prevent spills.

Briny wastewater is a byproduct of oil production, surging up from underground with the crude and natural gas. Energy companies separate it from the petroleum products and then must dispose of it, usually by pushing it down special wells drilled for that purpose.

Getting the billions of gallons of brine to these special wells often involves small pipelines. Traversing thousands of miles of rough and remote areas, sometimes under a blanket of snow, some of these pipelines have been plagued by leaks.