Stock prices plunged dramatically late yesterday when renewed weakness in the dollar and the bond market unleashed a wave of sell orders from program traders.

The Dow Jones industrial average, which had been up as much as 25 points during the day, suddenly plunged in the final hour of the session to close at 2610.97, down 51.98 points.

The loss, the fifth-largest point drop in Dow history, was the worst since the average fell 52.97 points May 15.

The last-minute selloff took place after a rumor circulated on Wall Street that President Reagan had suffered a heart attack. The rumor was denied by White House officials in California where the president is vacationing. Reagan was observed by television camera crews riding and clearing brush on his ranch yesterday.

The swing in the Dow from its high to low point was about 85 points.

After being up most of the day, the Dow at 2 p.m. was still up 19 points over the previous day's close. It was up 10 points at 2:30 p.m. and by 3 p.m. it was up 6 points. By 3:30 p.m. it had fallen to 12 points below the previous day's close and dropped to minus 60 before recovering to close at minus 51.98.

Declining stocks outnumbered gainers by about 2 to 1 in trading on the New York Stock Exchange.

Market analysts offered this description of the day's events:

Late weakness in the dollar once again triggered falling prices in the bond market, causing traders to sell futures contracts on stock indexes.

The falling prices of the futures contracts gave program traders an opportunity to take early profits by selling huge amounts of blue-chip stocks involved in computerized investment programs. The programs usually involve millions of dollars of stock and are part of a complex trading strategy using stocks and stock-index futures, pegged to the disparities between the two markets.

Volume on the NYSE, recorded at 139 million shares by 3 p.m., rocketed to 193.4 million before the market closed.

One reason for the deep slide was that the selling came late in the day when buying interest had dried up, said Michael Metz, market analyst at Oppenheimer & Co., New York.

"There was no support for the market. ... The market was in search of a rationale for selling, and the decline revealed the underlying weakness," he said.

The plunge, Metz said, left the market in danger of another drop today. "The market is in a precarious position," Metz said.

Eugene Peroni Jr., analyst at Janney Montgomery Scott Inc. in Philadelphia, said, "We have gone from a market which has been oblivious to conventional economic, monetary and political factors to being very sensitive to even unfounded rumors."

Peroni said he expected the market to remain under severe scrutiny by investors and traders who will be less trustful of its ability to absorb bad news.

The financial markets recently have held fast to a pattern in which a falling dollar has caused a drop in bond prices followed by declining stock prices.

Analysts observed that continued weakness in the dollar -- especially against the Japanese yen -- could prompt the Federal Reserve to tighten credit and boost interest rates to strengthen the dollar.

Higher interest rates can make bonds more attractive than stocks. Higher rates also can be a forerunner of higher inflation, which is considered a negative for stocks.

The dollar was quoted at about 141.40 Japanese yen in late foreign exchange trading in New York, down from 142.40 yen late Monday.

The dip in the dollar was followed by a drop in bond prices.

The Treasury's 30-year bond fell 1 1/8 points, or $11.25 for every $1,000 in face value. Its yield climbed to 9.27 percent from 9.16 percent late Monday.

The yield on 30-year Treasury bonds has not been that high since February 1986.

The broad indexes also reflected the havoc in the market.

Standard & Poor's index of 400 industrials dropped 7.57 to 378.26, and S&P's 500-stock composite index was down 6.40 at 323.40.

At the American Stock Exchange, the market value index fell 1.59 to 359.76. The Nasdaq composite index for over-the-counter stocks closed at 452.50, down 2.47.