IT HAS taken a perverse determination to be pessimistic about the American economy in recent years. A few courageous loners have worried that consumers don't save enough and that the trade deficit gapes rudely: Americans are effectively borrowing from foreigners in order to pay for foreign products. But with steady growth, no inflation and full employment, the trade deficit hardly seemed to matter. Just possibly, this may be about to change.

Yesterday the Commerce Department reported that June's trade deficit stood at $24.6 billion, up from $21.2 billion in May. This is remarkable, partly because the May figure had already set a record and partly because of recovery in Asia and Europe: Strong growth abroad should mean more demand for American exports and hence a smaller deficit. Most economists had in fact expected the deficit to fall; they underestimated Americans' appetite for imports.

In some circumstances this would hardly matter: Trade deficits are not damaging in the short term. In the long run, however, deficits are unsustainable: A country that buys more than it sells has to plug the gap by borrowing, and one day the lenders will decline to put up more. Judging the deficit's importance therefore involves judging investors' attitude to America. If the deficit swells just when financiers think they see rosier opportunities in other markets, the two factors could combine to trigger a big flight of money abroad.

A bit ominously, something like that confluence of circumstances may be in the offing. The day before the bad trade numbers came out, the dollar hit a six-month low against the yen; meanwhile, the dollar has fallen around 4 percent against the euro over the past month. Investors are reacting to recovery in Japan and continental Europe by shoveling money into those countries' stock markets. The worry now is that the trade figures will remind investors of America's unsustainable long-term deficit, and spook them into dumping the dollar before it gets any weaker, in which case, the long term may be now.

This, admittedly, is a worst-case scenario. Investors have lots of reasons to continue favoring America over ponderously regulated foreign rivals. But as a corrective to the complacency that inevitably sets in after years of expansion, it is worth contemplating the worst case a bit longer. If investors withdraw money, scarcer capital will mean higher interest rates and quite likely a weaker stock market. Corporate profits, investment and consumer confidence could all be affected. Rather quickly the American economy might cease to look invincible.

Policymakers can't do much about all this except to hope that the threat from the trade deficit fades as quickly as last year's scare of too weak a world economy seems to have done. The Federal Reserve is expected to nudge interest rates up at its meeting next Tuesday, which would be the proper response to the mild signs of inflation that have emerged recently. While it is doubtful this would support the dollar much in the longer term, policymakers can try to boost America's savings rate. But tax breaks and subsidies for savers, beloved by both parties, have a poor record of achieving this.

On the other hand, one policy response to the trade deficit must at all costs be avoided. That response is protectionism, which is always a worry in the run-up to a presidential campaign. Having denied President Clinton fast-track trade negotiating authority, Congress has recently demanded steel quotas. If the trade deficit reinforces that sort of instinct, little hope of progress can be expected in the new round of multilateral trade talks to be launched in Seattle in November. That would harm American prosperity more than a fall in the dollar or a stock market correction ever would.