Heading off a threatened collapse of the potato market, the New York Mercantile Exchange ordered an unprecedented halt yesterday in trading of spring potato futures.

The exchange said there were not enough high quality Maine potatoes available to satisfy futures contracts that called for delivery of nearly 11,000 boxcars of potatoes in the next three months.

If trading had not been halted, industry sources said, potato prices on the New York exchange might have soared to $20 a hundred pounds and many sellers would have defaulted on their contracts.

A default would have been a disaster for the potato futures market, which was hurt badly in 1976 when sellers failed to deliver on thousands of futures contracts.

Since then, several congressmen from potato-growing states have introduced legislation to end futures trading in potatoes, and a federal grand jury has begun an investigation of the entire potato marketing process.

The current troubles on the New York futures market are not expected to produce higher prices for consumers.

Nationwide there is an oversupply of potatoes, Department of Agriculture officials said, but there is a severe shortage of the highest quality Maine potatoes, the only kind traded on the New York Merchantile Exchange.

Although the Maine potato crop was harvested months ago, the shortage of top quality potatoes showed up only this week, when deliveries started on potatoes sold under futures contracts for March delivery.

The May price was frozen at that point yesterday, after the exchange's directors met Thursday night and declared a state of emergency. The exchange also froze the price of contracts for April delivery at its Thursday price of $7.60 per hundredweight.

Trading in both the April and May contracts was halted and the exchange modified the usual conditions for delivering potatoes under the March contract.

The exchange's quick action was praised by the Commodity Futures Trading Commission, which in 1976 criticized the exchange for not heading off the default.

CFTC officials were contacted by the exchange on Tuesday, after the quality problem was discovered on Monday.

CFTC and USDA investigators confirmed the quality troubles and verified that it affected most of the Maine crop.

If trading had not been halted, the price of May futures would have climbed indefinitely, industry sources said, because there were not enough quality Maine potatoes to be had at any price. The shortage of quality potatoes made a default "inevitable," one potato specialist said.

The price soared because persons who had sold contracts for May delivery of potatoes went into the market and tried to buy back their contracts, pushing the price even higher.

The economic impact of the suspension of trading in April and May contracts was unclear yesterday.

Speculators who had bought futures contracts and counted on prices going higher will not make the profits they hoped for, market observers said.

"Shorts" who sold futures contracts will avoid millions of dollars of losses that would have resulted if prices had gone higher.

But it is the New York Mercantile Exchange that probably will be the main beneficiary of the suspension of trading, industry sources speculated yesterday. If a default had occurred it would have discredited the exchange and renewed demands for banning potato futures.

The potato futures market is criticized often because it trades only in Maine round white potatoes, when the vast majority of America's potatoes are russets grown in the Northwestern United States.

In that part of the country, potatoes are in such oversupply that the government earlier this year agreed to pay farmers to chop up potatoes and feed them to cattle.

That action was meant to reduce the supply of potatoes and drive up prices paid to farmers, who have been receiving as little as 2 cents a pound for potatoes that sell in supermarkets for $2 for a 10-pound bag.