NEW YORK, JULY 11 -- The Dow Jones industrial average surged nearly 42 points today in a blue-chip rally spurred by optimism about lower interest rates and higher profits in the near term.

Two late-session waves of index-arbitrage program buying accounted for about 10 points of today's gains, but purely cash market volume gained steadily during the session as some longer-term investors climbed aboard the ''summer rally.'' Disgruntled bears scrambled to cover short positions.

''It looks like the market is heating up again,'' said chief trader Kenneth Ducey at S.G. Warburg.

The Dow settled at 2932.67, up 41.83, a meager 3.22 points below its all-time high. Advancing issues outpaced declining ones on the Big Board by an almost 2-to-1 ratio, but analysts said the ratio was not commensurate with the Dow's hefty advance.

New York Stock Exchange volume was 162 million shares.

While many analysts remarked on the bullish turn of market sentiment as interest rates remain reasonably stable and corporate earnings disasters remain isolated tragedies, incapable of undermining the broader market, others continued to scoff at the rally.

Stubborn bears continued to regard the entire May-July rally as a combination of program trading, index fund buying, and short covering -- a market moved by professional traders, index arbitragers, and other market ''insiders,'' they carped.

Stocks did well despite only mild gains in the bond market, and an auction of 7-year Treasury notes that was bid somewhat less enthusiastically than expected.

The long Treasury bond was flat on the day as stocks closed, apparently on ''second thoughts'' about how much supply the credit markets can swallow. Third-quarter Treasury needs are expected to rise sharply to about $70 billion.

Earnings reports generally received friendly to lukewarm receptions.

Industrial-coatings specialist DeSoto rose 4 at 43 1/2, a 10 percent gain on the day, after it announced that it will sell three of its paint units for $200 million.

Market fears about declining profits were also eased by better-than-expected quarterly reports from Safeway, Walgreen, Mead and Fannie Mae.

Among Dow component stocks, 11 issues posted full-point gains. IBM rose 1 3/8 to 119 1/8, Philip Morris gained 1 1/8 to 49 1/4, Merck added 1 7/8 to 88 1/4, Boeing moved up 1 1/2 to 61 1/2 and General Electric tacked on 1 3/8 to 72 1/8.

Hartmarx, which said it plans to shut down 65 stores and sell its minority interest in an affiliate as part of a restructuring, rose 1 to 11 3/8.

Sea Containers jumped 4 1/8 to 66. The company increased its quarterly dividend to 35 cents a share from 15 cents.

Public Service of New Mexico jumped 2 to 11 3/4. The company said it had received "a preliminary expression of interest" about a possible takeover from Wheeler Peak Capital.

Merry-Go-Round Enterprises, the Maryland-based specialty retailer, added 1 1/2 to 24 7/8 after Alex. Brown & Sons increased its second-quarter earnings estimate.

The Dow transports gained 9.68 to 1155.30, while the utilities rose 1.19 to 204.79.

Among broad stock indexes, the Standard & Poor's 500 was up 4.74 at 361.23, the NYSE Composite up 2.35 at 197.11, the Value Line up 2.25 at 287.06, the Amex Market Value up 1.68 at 359.41 and the Nasdaq Composite up 2.93 at 463.90.