It is a far cry from just a few years ago, when newspaper headlines told of the wrenching downturn in America's farm economy, and nightly television flashed the tearful stories of family after family dispossessed by foreclosure.

By almost every economic indicator, agriculture has bounced back, and even though at least 10 percent of the country's farmers are in deep trouble, most analysts see continuing modest improvement in the farm sector in 1988.

And on the consumer front, Agriculture Department economists project that retail food prices will rise from 2 percent to 4 percent, reflecting the 3 percent average over the past five years. Poultry and pork prices are expected to decline slightly because of high production, while beef prices are likely to remain steady.

The predictions of more improvement in the farm sector come on a backdrop of gains in just about every area in 1987. U.S. farmers closed the year with record net cash income of $57 billion and with increases in the volume and value of their exports.

Farm operating costs and debt were down, the stockpile of surpluses in most major commodities dwindled, land prices stabilized and even increased in a few areas. Congress paved the way for federal rescue of the Farm Credit System, the major farm lender, offering a line of credit that could stretch to $4 billion.

The picture clearly is brighter, but it is not as though U.S. agriculture has returned to full health or that it is again competitive in the foreign markets so vital to its survival.

As Agriculture Secretary Richard E. Lyng noted in a year-end review, there is a catch: In unprecedented ways, the federal government is underwriting the farm turnaround with billions of dollars in subsidies to income, exports, production and lending.

Government direct payments -- subsidies -- accounted for 21 cents of every dollar of farm income before interest in 1987. Lyng's figures indicate lower federal costs this year, but they still will represent about a fifth of farm income.

"No matter how you refer to them, they are large," Lyng said. From the high of $26 billion in fiscal 1986, federal expenditures are expected to be in the range of $19 billion to $21 billion this year. "Still high, still important and still necessary under what we are trying to accomplish, but still a continuing problem," he said.

Consider the contrast of a decade ago, when an export boom and land inflation gave farmers and experts a sense of no tomorrow. Government farm program costs averaged $3 billion per year in the 1970s. In the 1975-1979 boom period, only 4 cents of every cash income dollar came from Uncle Sam.

Lyng and others credit much of the change to policies forged in 1985 by the administration and Congress. They agreed to push down prices to make U.S. farmers more competitive in the export field, while buffeting them from the shocks by maintaining high levels of income supports.

This was an abrupt reversal from the 1981 farm bill when Congress decided to keep price supports and income subsidies high, overriding administration objections. Other global economic factors came into play, but most experts agree that the high U.S. prices stimulated production abroad, knocked American farmers out of markets and created a historically high mountain of surpluses.

Another key facet of the 1985 change involved subsidization of exports, with the government targeting traditional U.S. markets lost to competitors through unfair trading practices or crop subsidies. Through most of calendar 1987, the Export Enhancement Program, the most aggressive new tool given Lyng, sent $3.2 billion worth of farm goods into those markets with subsidies of $1.5 billion.

Export volume increased 20 percent in fiscal 1987 -- the first increase in the decade -- with a total value of $27.9 billion, a gain of $1.6 billion over the previous year. The principal gains were in cotton, livestock and fruits and vegetables. In that group, only cotton production is federally subsidized.

Precise reasons for the upturn were more elusive. Subsidies played a role, but bad weather plagued some growing regions around the world and the declining value of the dollar made it more attractive to buy American farm products.

"I'm not sure anyone can quantify the dollar factor," Lyng said, "because people make purchase commitments well in advance and there are even longer lags in terms of demonstrating increased competitiveness due to the dollar."

The subsidy programs and severe cuts in the amount of cropland U.S. farmers are permitted to keep in production have helped clear out much of the American surpluses that have contributed to depressed world prices for farm goods. Of the major U.S. commodities, only corn remains in heavy excess.

A combination of lower global crop output and rising demand is expected to keep U.S. exports moving up in 1988, USDA economist James Donald predicted at the department's outlook conference last month.