The number of companies in the beer industry is dwindling nearly as fast as the number of bottles on the wall in the old drinking song, "Ninety-nine Bottles of Beer."

Pabst Brewing Co. and Olympia Brewing Co. have agreed to a $70.2 million merger, and stockholders of Jos. Schlitz Brewing Co. have approved a takeover by Stroh Brewing Co. in the latest round of consolidations in the industry.

And Pabst, which last year tried to take over Schlitz, may not be done merging; G. Heileman Brewing Co. has made a $196.8 million bid for the company. If that offer is blocked by the Justice Department in the next few days on antitrust grounds, as is expected, Pabst has another suitor: C. Schmidt & Sons Inc., which it already has spurned three times.

These combinations come on the heels of several other mergers in the brewing industry that analysts say are the result of frantic attempts by medium-sized brewers to catch up to runaway industry leaders Anheuser-Busch Cos. Inc and Miller Brewing Co., a division of Philip Morris Inc.

Many of the mergers have involved beer companies that have fallen on hard times, such as Schlitz and F&M Schaefer Corp., which Stroh took over last year. Another former major brewer, Falstaff Brewing Co., reportedly is on the verge of liquidation, its beer shipments down 72 percent in the past decade.

Analysts say that the result of the consolidation in the beer industry may be the disappearance of the type of medium-sized regional brewers that dominated the industry for years.

"Essentially what you have occurring here is an implosion in what's left of the industry," says Donald W. Rice, an analyst at Blunt Ellis & Loewi, a Milwaukee securities firm. "When you have the disparity between the Big Two and the rest of the others, it had to happen.

"I think you'll wind up with a four-company top end, nothing in the middle, and a lot of small local companies," he predicts.

Just which brewers will fill out the Top Four behind Anheuser-Busch and Miller is still unclear. Although the combination of Stroh and Schlitz will rank third in the industry and the proposed Pabst-Olympia merger would create the nation's fourth largest brewery, analysts say Heileman, which currently ranks fourth, could make a move to retain or improve its position.

Although Heileman took over Carling National Breweries Inc. in 1979, its more recent attempts to take over another brewer have gone flat. Its $494 million bid for Schlitz last year was determined by the Justice Department to raise antitrust problems, and Pabst officials expect the agency to turn down a Heileman-Pabst merger on the same grounds--although it has indicated that it would accept the offer if the antitrust division gives its approval.