The outlook for stock prices in 1982 is as murky as the water in an untended goldfish bowl.

If the Reagan administration manages to keep the nation from sliding into a deeper recession without enacting spending increases or further tax cuts, investors are likely to remain confident. Stocks and bonds should be the big beneficiaries. February and March, analysts say, will be the key months as far as government policies and the future of the markets.

Should the recession get deeper and more prolonged than most economists anticipate, the devastating impact on corporate profits and the threats of surprise bankruptcies might combine to depress stock prices.

But Stewart J. Pillette, deputy director of research at the brokerage firm Drexel Burnham Lambert Inc., said the chances of a surprise bankruptcy seem more remote than they did a few months ago.

While recession-reduced corporate profits, which usually result in smaller dividends, are hardly good news, most investors think a recession that is neither too deep nor too prolonged is good news for stock prices because it generally results in lower interest rates and lessened inflation.

The initial beneficiary of lower interest rates is the bond market. Bonds, which carry fixed interest returns, rise and fall in price inversely to interest rates. While stocks may languish as investors try to sort out the length and depth of the recession, bonds usually begin to rise in price as soon as interest rates start to decline. In the current recession, bonds have risen sharply (although prices today are well below the peaks they reached in early December), to the point where some analysts say they are overvalued with respect to stocks.

Usually the consumer begins to lead the nation out of recession by increasing spending. Ironically, the Reagan administration's new policies designed to encourage investment may make recovery from the recession slower than would otherwise be the case.

Robert Farrell, the Merrill Lynch analyst who has one of the best records on Wall Street of picking turns in the stock market, advises caution. He said recently that although some analysts think it is wise to buy stocks soon to be in on the beginning of a rising market, a major recovery in stock prices is not likely until the middle of the year.

The stock market has recovered from the early fall, but does not seem to have much momentum. "We would not be surprised to see another decline in the stock market," said Harold B. Ehrlich, chairman of Bernstein-Macaulay Inc., who said a new setback may come early in 1982 "when the poor outlook for earnings become more apparent." Like Farrell, Ehrlich said he would "rather be sure than early in buying common stocks."

The year that just ended was a disappointment for most investors. In 1980, the Dow Jones Industrial Average of 30 key stocks rose 14.9 percent. Indexes that encompass a wider variety of stocks, such as the Standard & Poor's index or the New York Stock Exchange's own index, rose 25 percent or more.

But in 1981, after the initial euphoria that followed the election of Ronald Reagan, stock prices slid. The Dow average climbed to 1024 by April 28, then began a steady slide to the 825 level, where the deterioration halted. The Dow average since then has bounced around the 850 level, climbing close to 900, then falling back.

The Dow Industrials, which started 1981 at 963.99, finished at 875.00, a decline of 9.2 percent.

Historically, that performance should surprise no one. The stock market traditionally does poorly in years following a presidential election and is notorious in the years following Republican victories, despite the seeming friendliness of Republicans in general and Ronald Reagan in particular to business and investment. The last time there was a net gain in the Dow Jones average following a Republican victory was 1925.

The unsettling realization that the Reagan tax cuts were likely to stimulate huge budget deficits--which would keep pressure on the financial markets and interest rates as the federal government competed with private borrowers for funds--unnerved investors more than a friendly White House consoled them.

Now that the Reagan administration has acknowledged that a balanced federal budget is not a linchpin of its policies and has conceded that deficits will be much bigger than anticipated in 1983 and 1984 as well as 1982, investors may worry less about a desperate administration taking steps to fulfill its balanced budget promise that would wreak havoc elsewhere in the economy.

Furthermore, the recession should reduce private borrowings sharply, enough to make big federal borrowings manageable, although some analysts such as Salomon Brothers Inc.'s Henry Kaufman, think business borrowing will be heavy in 1982 and a conflict between federal and private needs by midyear will send interest rates on a sharp upward spiral again.

One continuing support for stock prices in 1981 was the rash of corporate mergers. Most acquiring companies pay a sharp premium over the current market value of the stock of a company it buys. The biggest merger in corporate history occurred in 1981, when E.I. du Pont de Nemours & Co. won a heated and bitter battle to acquire Conoco Inc., the nation's ninth-largest oil company.

Mobil Corp., one of the losers in the Conoco struggle, then locked in battle with U.S. Steel to buy another big oil company, Marathon. Last week, U.S. Steel won the battle. Many other multibillion-dollar mergers took place in 1981 and the hint that a company is a takeover target is enough to send its stock prices soaring.

But the merger mania is a function of relatively low stock prices. When companies' stocks are relatively cheap, other companies will find it better to buy them than to build their own plants, enter new businesses or explore for more oil.

Despite relatively low stock prices last year, the amount of stock sold by companies "going public" for the first time set a record. About 830 companies had initial public offerings that raised nearly $6.4 billion, according to the newsletter New Issues. That was more than twice the 380 companies that went public in 1980, and companies raised more than three times the amount of capital raised in similar offerings in 1980.

As always, the key to stock performance in 1982 seems to be the economy, or, at least, investor perceptions of where the economy is headed. Inflation, which has run in the double-digit range for several years, started to cool in 1981. Price increases should be even slower this year. If investors continue to believe inflation will slow, then so will interest rates, although the pattern could be erratic.

While lower interest rates will benefit the bond market, until investors figure out when the recession will end the stock market is likely to languish.

Historically, a stock market recovery occurs about three months before the end of a recession. That's the time when investors, forecasters and analysts decide that bad times are about over. Usually they are right.

They haven't yet decided that good times are just over the hill.