IT WAS nearly a decade ago that the federal program that paid farmers to withold land from production ended. But the feeling persists that somewhere" out there" there is plenty available farm land. Not so. In fact, it appears that because of accelerating demand for farm products and the rapid loss of crop land, the United States may move in the space of a decade or two from surplus to shortage.

The National Agricultural Lands Study, published a few days before Mr. Reagan's inauguration, documents a trend of alarming proportions. Every day, four square miles of prime farm land are irretrievably lost -- paved over, built on or flooded by dam construction. The yearly total of 3 million lost acres is equivalent to a half-mile wide corridor reaching from coast to coast.

The growing demand means that more not less agricultural land will be needed, though how much more is uncertain. Both the growth in domestic and foreign demand for food and the amount of land needed to grow energy crops are difficult to predict. The rate of future growth in agricultural productivity -- the harvest per acre -- is even more controversial. The government's lands study settled on a range that should cover all contingencies of 85 to 140 million additional acres needed by year 2000.

For once an impending problem has been identified before it reaches crisis proportions. It remains to be seen whether the will to do something about it can be summoned while the solutions are still relatively painless. Population growth and the continuing migration from urban to rural surroundings can be accommodated on lands not suited to agricultural use. The trick is to find ways to direct development away from farm land. If that is not actively done, and soon, past experience shows that development will happen first on the best land, leaving land that is impossible or much more expensive to farm to meet the growing need.

Primary responsibility for finding the tools to do this rests with state and local governments. But there is a need for federal action that arises not just from the clear national interest in preserving its agricultural strength, but also from the federal government's major, if unwitting, contribution to the current losses. The lands study identified 90 federal programs that now provide financial support to the permanent urbanization of farm land.

The government needs to get its own house in order by formally recognizing the national interest in preserving farm land and redirecting programs that do the opposite. Information and technical support are also in order -- no additional money should be needed -- to help state governments wrestle with the problem before development forecloses their options.