The stock market, leaving its interest rate and economic worries behind, roared ahead yesterday, carrying the Dow Jones industrial average to a new peak of 1,297.92, the second record set by the Dow this year.

The gain for the day, which broke several other records, added 21.31 points to the industrial average on a volume of 169.9 million shares. It was the 25th day in a row that saw volume over 100 million shares. In yesterday's trading, 1,228 issues advanced, 406 declined and 399 were unchanged.

Confirming the forecasts made for 1985 by many Wall Street analysts, the market briefly swept over the magic 1,300 figure to 1,302 near the end of the session before settling back to close at 1,297.92. The previous record was set on Jan. 29, when the market gained 14.79 to close at 1,292.62.

Standard & Poor's 500-stock index jumped 2.79 to an all-time high of 183.35, beating a record set Feb. 8. The New York Stock Exchange Composite Index also hit an all-time high, reaching 106.08, up 1.51. The average price per share was up 50 cents. The American Stock Exchange Index was up 2.02 to 231.22. The average price per share there gained 12 cents. The Nasdaq index gained 1.75 to 288.32.

The Dow Jones transportation average rose 9.19 to 634.52, ahead of the all-time record of 630.09 set Feb. 8.

With stocks rising steadily since Jan. 1, the market has gained an estimated paper value of $188 billion, based on the Wilshire Associates 5,000-stock Equity Index, which measures the market value of 5,000 issues on the New York Stock Exchange, American Stock Exchange and the over-the-counter market.

John D. Connolly, chairman of the investment policy committee of Dean Witter, said he saw a clear move on Wall Street from a "defensive to offensive" posture. He recalled that only a few months ago, defensive stocks, including those of utilities and food and beverage companies, were the focus of heavy buying. Now, he said, the emphasis has moved to growth stocks, especially high-technology stocks. Investors, he noted, were willing to take higher risks to get stocks with growth potential.

Connolly said that institutional investors who were "pushing up the market" had been encouraged by dwindling competition from bonds, a firming of the economy, and their perception that chances for tax law changes that would hurt U.S. corporations were diminishing.

Connolly noted that IBM, which had been off the last two days, had rebounded $2 a share to $133.75. The strength shown by IBM was credited by other analysts with contributing to the market's huge surge.

The role of institutional investors was shown as block trades of 10,000 or more shares totaled nearly 3,400, about 900 more than Tuesday.

Hugh Johnson, an economist with First Albany Corp., told Reuter that a lot of the institutional money now entering the market is coming from individual retirement accounts that perk up during the tax season.

Michael Metz of Oppenheimer & Co. told United Press International that "people were waiting for a setback, and when it didn't come, it triggered a stampede." The market had dipped about 14 points Monday but then managed a small gain Tuesday.

Metz said some short sellers -- traders who sell borrowed shares in hopes of a price decline -- covered their positions when the advance started.

"I think we're close to the peak for a while," Metz said. "While the economy is all right, corporate profit margins are not." He said imports are causing problems for many companies.

Among the volume leaders on the NYSE, American Telephone & Telegraph was up 1/2 at 21 3/8, Eastman Kodak was up 3/4 at 70 1/8, and Sears was up 1/2 at 35 3/8.

Although IBM was up, some technology issues were down. Data General, which lost 14 1/8 on Tuesday, was off another 2 1/8 at 56 5/8, National Semiconductor was down 1/4 at 13 1/4, and Digital Equipment was down 5/8 at 116 3/8.

Gainers yesterday included Handelman, up 3 5/8 to 50, Teledyne, up 3 to 265, and Loews, 5 1/4 to 132.