PITTSBURGH (AP) _ Allegheny International Inc., struggling bolster its finances and pare its businesses down to narrow a core of consumer products, said Monday it had agreed to a $500 million buyout by The First Boston Corp.

First Boston said it would pay $24.60 cash a share for Allegheny International's 10.8 million common shares outstanding. The announcement quickly lifted the shares from Friday's closing price of $15.37 1/2 to a closing price of $24 in trading on the New York Stock Exchange.

First Boston said it will finance the acquisition with money borrowed against future earnings of Allegheny International. The deal hinges on the cooperation of Allegheny International's shareholders and bankers, who have placed restrictions on the company because of recent financial difficulties.

''The plan is to run it along the lines that AI managment chooses,'' said Monica Prihoda, spokeswoman for New York-based First Boston.

The buyer will also pay $20 per share, or $56 million, for 2.8 million shares of $2.19 cumulative preferred stock and $87.50 per share, or $166 million, for 1.9 million shares of $11.25 convertible preferred stock.

Securities analyst Gregory Drahuschak, who follows Allegheny International for Butcher & Singer Inc. in Pittsburgh, said First Boston may be acting on behalf of an unnamed buyer.

''It is extremely unlikely that First Boston is the buyer,'' he said.

Oliver S. Travers, who replaced embattled Chairman Robert J. Buckley last August, will remain chairman, president and chief executive. Thomas J. Albani will remain chief operating officer, said company spokesman Edward M. Romanoff.

Allegheny International managers may participate in the leveraged buyout, Ms. Prihoda said.

''Our primary objective is to improve the company's financial condition,'' Travers said in a printed statement. ''We're going to reduce AI to a size consistent with our financial resources ... a smaller, financially sound, consumer products company which operates predominantly in the stable political and economic environment in North America.''

The company owns a variety of industrial and high technology businesses, but makes three-quarters of its annual sales through consumer products units, Sunbeam, Oster, Wilkinson Sword, Almet-Lawnlite, Hanson Scale and Northern Electric.

Its earnings have been in a nose-dive since 1981.

The company said Monday its fourth-quarter operating loss widened to $151 million on sales of $346 million, compared to $38 million on sales of $392 a year earlier. The net loss for the fourth quarter was $166 million, compared to $53 million in the last three months of 1985.

For all of 1986, Allegheny International showed a net loss of $164 million compared to $109 million in 1985.

Allegheny International's board of directors ousted Buckley after shareholders sued the company over what they alleged was the waste of millions of dollars under Buckley's leadership.

The company sued Buckley in February, claiming that without authorization he changed a $1 million life insurance policy so that the widow of an Allegheny International executive would receive the death benefit. The company purchased the policy in 1984.