Trying to figure out what to do about the huge U.S. trade deficit is a little like the joke about asking the old farmer how to get somewhere. "Well," he replied after long thought, "if I were you, I wouldn't start out from here."

In trade terms, the United States is in such a deep hole that it is going to take years, and probably a great deal of restraint on consumption, to climb out. The process could easily involve putting the nation through the wringer of a recession, though no policymaker is aiming in that direction.

Traditionally, austerity programs and recessions have been forced upon nations whose international balance sheets fell badly into the red. As consumer spending and business investment drop during an economic slump, the demand for imported goods typically falls sharply. Meanwhile, if growth continues in other nations, export markets may be little affected by the recession in the producing country. As imports fall and exports grow, the international deficit can drop dramatically.

That is how trade deficits are supposed to disappear, but it hasn't happened to the United States. Traditionally, companies with unmanageable trade imbalances discover they are no longer able to keep borrowing abroad to finance their international deficit.

That hasn't happened to the United States, although many analysts believe the rise in U.S. interest rates this year was partly the result of a growing reluctance of private foreign investors to supply an ever-growing volume of capital to the United States.

To overcome that reluctance, rates of return on investments had to go up -- or else the price of those investments to foreigners had to go down. That happened, too, as the value of the dollar declined relative to the currencies of the countries whose residents had capital to invest, such as Japan, West Germany and Britain. When the dollar went down, the price of a U.S. government bond, a New York City office building or a corporate stock became cheaper in terms of Japanese yen, West German marks or British pounds.

Meanwhile, far from slowing down, economic growth in the United States accelerated to more than a 3 percent annual rate over the last four quarters, a faster pace than that of most other industrial nations save Canada and Japan.

Thus, any drop in demand for imports came as a result of price increases set by foreign producers as they tried to offset some of the impact on their income from the declining dollar. With a cheaper dollar, a foreign exporter earns less in terms of his own currency from sales to the United States. His profits get squeezed because he continues to pay a large part of his production costs in his home currency.

Higher import prices, which have slowed the growth of imports, also made the actual cost of imported goods in current dollars go up considerably faster. While the volume of imports was rising only 3.1 percent between the third quarter of 1986 and the third quarter of this year, their cost in dollars rose 12.3 percent.

Thus, imports are so much greater than exports that exports must grow not just faster than imports -- they must grow much faster to close the trade gap.

Moreover, imports remain so much greater than exports that a modest improvement in export growth doesn't help. Between the third quarter of 1986 and the same period this year, merchandise exports increased 18.4 percent, or $41.5 billion, on an annual rate. The increase in imports was slower -- only 12.3 percent -- but because the base of imports was so much greater, that increase came to $46.3 billion. Accordingly, the trade deficit rose from an annual rate of $149.7 billion to $154.5 billion.

This arithmetic for the past year underscores some of the unpalatable tradeoffs in reducing the trade deficit. The solution involves either measures to slow growth of domestic demand, or higher prices for imports -- or, more likely, a significant dose of both.

Again, it is not necessarily a matter of any government policymaker deliberately making such choices. Almost no one expects foreign investors to continue indefinitely financing U.S. international deficits of $160 billion -- the likely level this year -- or even $100 billion. This year, for example, much of the capital inflow financing the deficit has come from foreign central banks that have dollars to invest as a result of intervening in the currency markets to prop up the dollar. In 1986, far more of the needed capital came from foreign private investors.

The foreign central bank intervention did cushion the fall of the dollar for a while, and last week's new agreement among the governments of the United States, Japan, West Germany, Britain, France, Italy and Canada to try again to stabilize the value of the dollar suggests more intervention is on the way.

The foreign central banks acted to aid their exporters whose profits were being squeezed by the dollar's decline. Of course, the intervention also helped reduce pressure to raise prices of goods being shipped to the United States -- one reason the U.S. government went along. But that also delayed to some extent improvement in the U.S. deficit.

Just as no one in the United States particularly wants to consume less or have higher interest rates or a recession, foreign governments are not eager to take steps to reduce the trade surpluses that are the counterparts of the U.S. deficit.

Nor are foreign exporters anxious to raise their U.S. selling prices and risk losing their share of the largest market in the world. In some cases, such as several Japanese auto makers building new production facilities in the United States, there are particularly strong reasons to try to hold on to one's market share until the new plants are producing made-in-the-U.S.A. cars where costs are being incurred in dollars rather than yen.

Furthermore, many foreign producers have not been seriously hurt by the overall decline in the dollar. In some important instances, their currencies have not gone up significantly against the dollar.

The dollar peaked in value in February 1985. As of last week, it had skidded more than 50 percent compared with the yen and mark and between 40 percent and 50 percent compared with most other West European currencies.

But nearly 20 percent of total U.S. trade is with Canada, and the American currency has gone up 3.5 percent against the Canadian dollar since early 1985. The U.S. dollar has also gone up, after adjustment for inflation, compared with the Mexican peso, and more than 5 percent of U.S. trade is with that nation. And it has gone up sharply compared with the yuan, the currency of China, which is now one of the top dozen trading partners of the United States.

Also, the dollar has gone down only 5.3 percent against the South Korean won, 11.2 percent against the Singapore dollar and 27.3 percent compared with the Taiwanese dollar. Those three countries account for more than 10 percent of all U.S. trade.

In rough terms, the dollar has gone down significantly compared with the currencies of nations that are involved in about half of all U.S. trade. In the other half, the dollar has gone down modestly or not at all. Moreover, since inflation has been higher in the United States than in some countries where the changes in currency values have been greatest, particularly Japan and West Germany, the real shift in exchange rates is smaller than it would appear.

Both a large improvement in the trade deficit and, at the same time, its persistence is reflected in the latest forecast for the economy from Data Resources Inc., an economic consulting firm. DRI economist Roger Brinner says a combination of soft consumption and weak business investment, particularly inventories, will hold economic growth below a 1 percent annual rate in the first half of 1988.

The forecast also shows imports increasing slowly while exports continued to grow at double-digit rates. Brinner says business inventories will hardly rise at all in response to the slowdown in consumer spending, and that will help the trade balance. "We think foreign producers will get to bear a lot of the pain of this inventory cycle," Brinner said.

With all the usual arithmetic at work, the forces in the economy will produce a decline in the merchandise trade deficit from a $154.5 billion annual rate last quarter to about $120 billion in the fourth quarter of next year, according to the forecast. Adjusted for inflation -- that is, expressed in terms of dollars with the purchasing power they had in 1982 -- the decline is much bigger. On that basis, the deficit falls from a $134.9 billion rate last quarter to about half that by the end of next year.

Paying for the deficit, unhappily, has to come in current dollars, not inflation-adjusted dollars.

The final difficulty in dealing with the United States' international deficit is that it includes more than just merchandise trade. There is trade in services, tourism, private payments by individuals working here to families abroad, and there are earnings on U.S. investment abroad and foreign investment in the United States.

For many years, the United States could count on a substantial surplus in trade in services and net investment income. The other items, such as tourism, almost always have been in deficit.

But in the third quarter a new milestone was reached. Income received on U.S. investments abroad fell behind payments to foreigners on their investments here once U.S. government interest payments to foreigners holding part of its debt are included.

The longer the trade deficits continue, the greater will be the investment advantage foreigners hold, and the more goods and services the United States will have to produce and export to have the income to pay its debts. Barring some magical increase in U.S. productivity, which few if any analysts expect, the greater the share of U.S. production that has to be shipped abroad to bring the country's trade accounts into acceptable balance, the greater will have to be the ultimate restraint on consumption.

That is the real meaning of reducing the trade deficit.