Stock prices dropped sharply today, closing at their lowest levels in 15 months, as investors realized the new Carter anti-inflation program could trigger a serious recession and a sizable decline in corporate profits.

The Dow Jones industrial average dropped 23 points to close at 788.65, its lowest level since Dec. 18, 1978. On the American Stock Exchange, prices fell 12.83 points to 249.2. It was the biggest one-day decline in seven-year history of the Amex index.

But the bond markets, which have sagged all year under the pressure of accelerating inflation, gave the president a vote of confidence.

Bond prices were stable most of the day and closed up slightly higher in a late trading rally. Short-term interest rates fell slightly.

Commodity prices continued to fall as well. In New York, gold closed down $57 an ounce to $469; silver was off $3.80 at $17.20 and platinum fell $102 an ounce to $588.

Prices of grains also declined. The drop in the Dow Jones average was the biggest one-day decline since last Oct. 9 when it slipped 26.45 points after the Federal Reserve Board announced a new anti-inflation monetary policy.

James Balog, senior executive vice president of Drexel Burnham Lambert Inc., said the divergent trends in the stock and bond markets "make eminent sense."

He said that despite the budget-cut rhetoric in Washington and elsewhere about Carter's anti-inflation program, the big weapon in the package is "monetary and credit restraint" from the Federal Reserve Board.

He said the stiff measures the Fed proposes -- a restriction on lending at major banks plus a sharp increase in the cost of funds to these banks -- means that a "slow-down in economic activity and a peaking of interest rates is not too far off."

To the bond markets that means a restoration of "some degree of stability" Balog said.

The stock market is looking at the "obverse side of the same coin; a recession and a lowering of corporate earnings," Balog said.

"The president gave us everything we asked for," said Peter Goldsmith, chief of bond research at Merrill Lynch, Pierce Fenner and Smith. "The bond market's reaction today has to be considered a favorable one."

Goldsmith noted that with interest rates at record highs -- the prime rate is 18 1/4 percent as many major banks and as high as 18 1/2 at some -- no sharp sustained rally in bond prices can be expected. Bond prices move in the opposite direction from interest rates. As rates rise, bond prices fall.

Even though interest rates may move higher still as the Federal Reserve policies make credit increasingly harder to come by, the bond markets see stability in the near future and act accordingly, Goldsmith said.

On the New York Stock Exchange, 1,468 stocks declined in price, while only 197 rose.Volume was 37.5 million shares, up from Friday's 35.2 million shares.

But far fewer shares changed hands today than in the frenzy that followed the Oct. 6 Federal Reserve announcement that it was tightening monetary policy to fight inflation -- even though the moves the Fed announced Friday and Saturday may be tougher than the steps it took last year.

Some stock market analysts said, however, that the market reaction today reflected as much a lack of confidence in Carter's policies as it did a conviction that a recession was on the way.

One analyst said that while the recession would moderate inflation temporarily, the Carter package is not a long-term answer to the inflation problem. Inflation will be worse once the recession is over, he said.

Whatever, most of today's trading in the stock market was dominated by individuals. Big institutional investors, such as pension funds, stayed on the sidelines, according to Balog.

The Dow average danced around the 800 level until about 2:30 p.m. But once the market fell below 800, buyers seemed to evaporate. The market was down 10.92 at 2:30 p.m. and closed off 23.04. The New York Stock Exchange average closed down 1.85 at 58.22.

Analysts said that yet a further contributing factor to the decline to stock prices is the high cost investors must pay to borrow money from their brokers to buy stocks. The interest charge to investors is now about 20 percent if they buy stocks on margin.

As a result, analysts said, in many investors sold stocks today as they have been doing for the last few weeks, because the financing charges are so high.