NEW YORK, JULY 7 -- Stock prices rose broadly today, bolstered by strength in the dollar and bond prices and by foreign buying.

The Dow Jones average of 30 industrials rose 20.25 points to close at 2449.78.

Advances outnumbered declines by about 2-to-1 on the New York Stock Exchange, with 1,052 issues advancing, 563 declining and 376 unchanged. Volume on the Big Board totaled 200.73 million shares, up from 155.01 million in Monday's session.

The rally began early in the trading session and was sustained through most of the day, although prices retreated slightly in late trading. Analysts attributed the day's advance largely to foreign demand, especially from Japanese investors, and to the strong dollar and stable bond prices.

The day's rally was touched off early in the session by Lt. Col. Oliver L. North Jr.'s testimony at a congressional hearing on the Iran-Contra affair.

The former National Security Council aide said he never discussed with President Reagan the issue of the diversion of funds from arms sales to Iran for use by rebels in Nicaragua. North also said Reagan never raised the issue with him.

"Ollie North has apparently taken the president out of harm's way," said Larry Wachtel, an analyst for Prudential-Bache Securities Inc.

The dollar topped the psychologically important level of 150 Japanese yen for the first time in more than three months. Declines in the dollar earlier this year raised fears of high inflation and pushed bond prices lower and interest rates higher.

Despite the strength of today's rally, some analysts said the market remained vulnerable to profit taking or to bad news from the stream of second-quarter corporate earnings reports expected soon.

Among actively traded NYSE issues, Texaco was unchanged at 44 3/4, USX advanced 2 3/4 to 35 and AT&T rose 1/8 to 29. Kidde jumped 9 7/8 to 61 3/8. The manufacturer said it was considering a possible restructuring or sale of all or a major part of its business. Southland declined 1/8 to 75 5/8. The company disclosed it was the object of shareholder lawsuits over its proposed leveraged buyout and said it would challenge the suits.

Nationwide turnover in NYSE-listed issues totaled 236.11 million shares. The NYSE composite index was up 1.34, at 172.89. Standard & Poor's index of 400 industrials rose 3.29 to 358.21, and S&P's 500-stock composite index was up 2.48 at 307.40.

At the American Stock Exchange, the market value index rose 2.50 to 344.45. The Nasdaq composite index for the over-the-counter market closed at 424.55, down 0.55.