The Reagan administration, which came to town pledging to get the government out of agriculture, now is presiding uneasily over the most expensive farm program in history, and the farm-food problem could well become a leading issue in next year's election.

Republicans are nervous, Democrats gearing up for the attack. Still another batch of cost-cutting bills has been put forward on the Hill, but they are getting nowhere.

Farm support programs--loans to farmers who put crops in government storage and direct payments to farmers when prices fall below targeted levels--are expected to hit $21 billion this year. This is on top of the payment-in-kind (PIK) surplus giveaway that will put another $12 billion worth of wheat, corn, rice and cotton in farmers' hands for idling part of their land.

By way of comparison, support costs in the final year of the Carter administration came to $3.5 billion, although agricultural conditions were far different then than they are today.

The cost explosion was caused by a combination of factors, most farm observers say: recession, sagging prices, a strong dollar and declining exports, record crops in 1981 and 1982, and the free-market-minded administration's refusal to take strong supply-management steps at the first signs that the budget was getting out of hand.

In any case, the record costs have set off jitters in the administration and drawn warnings from Secretary of Agriculture John R. Block and farm-state legislators that unless there are cuts, there will be a powerful backlash against further farm support programs and serious difficulty in writing farm legislation in 1985.

"Farm program costs are simply out of control. They are not going to self-correct, but they very well might self-destruct," Sen. Robert J. Dole (R-Kan.) said recently.

But despite calls by Block and Dole for congressional action, administration proposals to cut costs have languished through the spring and summer in a tangled debate over the entire farm program, with Democrats in no mood to help solve a GOP administration's problem.

Congress and the White House are at odds over grain, cotton and rice support programs for next year; they are at odds over export subsidies proposed by farm-state legislators; they are at odds over ways to cut the $2 billion-plus yearly cost of dairy supports. Key to this spat is an expensive thing called target prices, which determine direct subsidies to help farmers cover production costs when farm prices are low. They are projected to cost more than $3 billion next year.

Block took office in 1981 advocating an end to the target price concept, but it survived in close votes when Congress hammered out its four-year farm bill.

At the administration's insistence, Congress agreed to abandon the practice of pegging the payments to inflation and put exact price levels in the bill.

That, in the eyes of many, was a major miscalculation by Block and David A. Stockman, director of the Office of Management and Budget. Had they stuck to the indexing approach, target price outlays would have been far less, Democratic farm spokesmen such as Rep. Thomas S. Foley (Wash.) have charged.

Harold Breimyer, a nationally known economist from the University of Missouri, recently put it this way at a congressional hearing: "Mr. Stockman's tightfistedness was penny wise and billion-dollar foolish."

As target price payments climbed in 1982 and continued upward in 1983, Block proposed a freeze, which he said would save about $370 million in 1984 and more than $1 billion in 1985.

Treachery, cried the Democrats. Led by Sen. John Melcher (D-Mont.), they talked the proposal to a standstill with a filibuster just before the Senate went on its August recess. They argued that the targets mandated by the 1981 farm bill are vital income protection for farmers at a time of market uncertainty.

Furthermore, Melcher and others said, the administration's support of the farm bill was a commitment to farmers. By proposing now to revise the target-price formula, they charged, the White House was breaking a promise to agriculture.

Farm organizations are divided over the proposal, as are farm-state legislators, but Melcher said he didn't expect he will feel any differently when the Senate resumes debate next month.

Block and Stockman have raised the ante, and in the view of many farm-state legislators, spent valuable political capital here and across the country by holding other programs hostage to the target freeze.

They have suggested a presidential veto of a revised dairy program if the freeze on grain, rice and cotton targets is not adopted. Block riled Congress more by delaying an announcement of his 1984 wheat acreage reduction proposals and then riled it some more by announcing his intention to cut the price-supporting loan rate.

"The chances for the freeze don't look good," J. Dawson Ahalt, deputy assistant secretary for economics, said last week. "We have felt we had to take a tough stand on this. Target prices got out of line. We put the freeze in the proposed budget as a legislative proposal. With USDA outlays out of control, we had become a major violator of spending limitations."

"We want to do something. Otherwise, we'll have an unbelievable time on the 1985 farm bill. Whatever we can do between now and then to get these costs down will help," Ahalt said.

Most of the farm groups and farm-state legislators agree with him. But no one agrees on a solution. The real problem is that 1984 is a lot closer--and a lot more important politically--than 1985.