NEW YORK, JULY 3 -- The Dow industrial average rose 12 points today, its fifth consecutive gain.

The bond market again provided some underpinning for stocks. The 30-year Treasury bond rose from a small morning loss to post a small gain of 5/32 at the close, taking in stride the news that the Treasury would be in the market next week with a larger-than-expected offering of notes and thrift cleanup bonds.

The stock market's gains were fed partially by light computerized program buying. There was also technical buying as the Dow breached ''round-number'' resistance at 2900 for the first time in six sessions.

The most prominent volume leader was not on the New York Stock Exchange, however, but on the Nasdaq system, where Mentor Graphics fell into what Wall Street terms a ''black hole.'' The stock plunged as much as 30 percent at one point, after the company announced that second-quarter earnings will run below expectations. The stock rose to volume leader on the Nasdaq system, finishing off 4 3/8 at 17 5/8.

Although Mentor's sharp sell-off did not spread to other high-technology issues, it did encourage some profit-taking in such high-flying stocks as Compaq Computer, which dropped 2 to close at 123 1/8. Moreover, the Mentor debacle reinforced perceptions, derived from such other recent price free falls as that of Caterpillar Inc., that this market brooks no disappointments on the earnings front.

At the close, the Dow stood at 2911.63, up 12.37, while advancing issues outpaced declining ones on the Big Board by a 4-to-3 ratio on surprisingly strong pre-holiday volume of 130 million shares.

Kay Jewelers slipped 5/8 to 13 3/4 as some junk bond holders reacted coolly to the offer from Britain's Ratners Group to buy up the paper at 75 percent of its face value.

General Instrument rose 1/2 to 45 5/8 in heavy trading, an indication that some traders believe another suitor will emerge for the company willing to pay more than Forstmann Little's buyout bid of $44.50 a share. Analysts said the potential bidders include a number of U.S. telecommunications companies.

Washington area bank stocks continued to take a beating in heavy trading as a number of banks warned that their second-quarter profits would continue to reflect problems with real estate lending. Signet, which said it expects minimal earnings for the quarter, regained 5/8 to to close at 19 7/8 after losing 3 3/4 Monday. Crestar shares dropped 1/4 to 21 5/8 after announcing it would add $25 million to its loan loss reserves. Sovran Financial lost 1 1/4 to close at 26 3/4.

Pharmaceutical stocks, consistent winners for the past week of trading, continued to provide the clearest leadership for blue chips as Eli Lilly rose 1 1/8 to 84 3/4 and Rorer tacked on 1 5/8 to 71 5/8. Fully 14 of the top 19 drug stocks rose at least fractionally.

The Dow transports, which have long underperformed the industrials, remained in character today by slipping 3.65 to 1140.51, largely on losses in American President, down 1 1/4 to 21 1/8, and AMR Corp., down 1 1/8 at 63. The interest-sensitive utilities slipped 0.63 to 208.94 despite modest afternoon firmness in the bond market.

Among broad stock indexes, all gains were small and the chief Nasdaq measure lost ground. The Standard & Poor's 500 was up 0.62 at 360.16, the NYSE Composite up 0.39 at 196.61, the Value Line up 0.24 at 287.23, the Amex Market Value up 0.53 at 360.67 and the Nasdaq Composite down 0.28 at 461.76.