Inflation, high interest rates and economic uncertainty are the greatest enemies of stock prices.

The summer -- and indeed the entire year -- has been one in which inflation has cavorted in the double-digit range, interest rates have climbed to record levels and economists have debated whether: a) the nation is in a recession and b) whether it will be mild or severe.

It should have been the worst of all worlds for stock prices.

Instead, with the usual ups and downs that characterize market behavior, stock prices have climbed since January, especially since mid-July when things were at their worst.

"How perverse the action of the market seems once again," noted Harold B. Ehrlich, chairman of Bernstein-McCaulay Inc.

It is that perversity (stock prices fell sharply in 1977 and 1978 when the economic scene was much better than in 1979) that gives both market forecasters and investors fits.

Most analysts, anticipating correctly the economic climate of the first half of 1979, thought the Dow Jones average of 30 industrial stocks would fall below 800 by summer and show little significant gains until late in the year.

Instead, the Dow Jones -- the most widely watched, although far from the best, indicator of overall stock trends -- hit a high for the year of 887.63 on Aug. 31.

Then, in the week following Labor Day, the Dow Jones lost 13.48 points. That was just about the time the once bearish analysts' community was taking up a bullish cudgel.

Historically, the market's performance in the Labor Day week has been a key to its performance for all of September. If prices sink that week, they will be lower at the end of the month as well, and vice versa.

As E. F. Hutton's Newton D. Zinder noted, "This has been true in 16 of the last 19 years, which is certainly an excellent record for any indicator," although he said last year was one in which the Labor Day early warning did not forecast properly.

So, if the Labor Day barometer is right, stock prices will continue to slide for most of September.

That certainly spells bad news for the near term.

But the stock market has nearly as many barometers as the New York Stock Exchange has listed stocks.

While the Labor Day barometer suggests September will be a bad month for investors, the September reverse barometer indicates that the last three months of the year will be good, on average, for stock prices.

Smart Money, a stock advisory newsletter, said the so-called reverse barometer has been right two-thirds of the time. If all the early warnings hold true, the last three months of the year will be good for equity investors.

Of course, stocks have two things going for them right now, despite continued high inflation and rising interest rates:

Stocks are still underpriced relative to most other alternative investments, including high-sailing gold.

Big institutional investors, who have been a major factor in the price rise this summer, have a huge amount of cash in reserve, sitting now in money market securities, that could be used to buy stocks at any time. At the same time, however, these institutions such as pension funds, could trigger another sharp decline merely by sitting on the sidelines and not buying. About half the trading on the New York Stock Exchange is done by big traders.

All institutional investors don't behave alike, any more than do market forecasters or economic forecasters. But there is a herd instinct among Wall Street investors.

Most analysts attribute much of the summer strength in stock prices to a buying binge by cash-rich institutional buyers who suddenly got scared that they would miss out on the beginning of a stock market boom if they did not begin purchasing at once.

If continuing inflation and high interest reates scared those same buyers away from stocks, and they are content to invest their funds in 10.5 percent government securities for a while, then the September downturn that the Labor Day indicator predicts will indeed come to pass.

A decline in stock prices over the coming weeks would be more in line with normal performance during periods of economic difficulties.

But historically recession has been good news for stock prices in the end. Once investors shake off the bad news of earnings declines, they begin to see the good news of lower inflation and falling interest rates.

The debate over the recession should soon be resolved by the performance of the economy itself. The Federal Reserve will back off its tight-money policy, although not before interest rates soar to new peaks.

Those events by themselves should serve to push up the stock market by November.

But there is one more fly in the ointment, as Robert S. Salomon, of the investment banking firm Salomon Brothers, pointed out. Investors have been financing their stock purchases by going heavily into debt, especially on the American Stock Exchange, where stock prices have done much better on average than at the bigger New York Stock Exchange.

"Bull markets do not spring from swollen depths positions; as a matter of fact, quite the contrary is true," Salomon said.

But the debt problem is greater for individuals than institutions -- who use the cash they have in Treasury bills to buy stock.

So, at the American Exchange, where prices have risen in general for the past several years, a debt-burdened small buyer may be forced to opt out of a new buying spree, while at the institution-dominated NYSE, the future will be determined by the perceptions of portfolio managers.

Whether that means the markets will again perform perversely is something only a crystal ball can tell.

Investors who want to gaze should make sure they buy their oracular devices from a different producer than the one who supplies the Wall Street forecasters.