Ending a four-month takeover fight, executives of the Macke Corp. yesterday announced an agreement to sell out to Allegheny Beverage Corp. of Baltimore for nearly $43 million.

Allegheny, which already has bought almost 35 percent of Macke's stock, will pay $14.50 a share in cash -- a total of $29 million -- for the remaining two million shares of the Washington vending machine, furniture and restaurant company.

The purchase requires the approval of a majority of Macke shareholders, but two Macke founders who own another 16 percent have agreed to aid the Allegheny offer, assuring the offer will get a least 51 percent of the vote.

Macke Chairman Meyer Gelfand said he and retired chairman Aaron Goldman as well as some members of their families have given Allegheny options to buy 492,000 shares and to vote the shares in favor of the take-over. o

The options to buy the Goldman and Gelfand shares for $14.50 can be exercised only if Allegheny also buys all the rest of the stock, Gelfand said.

Gelfand and Goldman rejected an offer from Allegheny last April, then launched a series of unsuccessful legal maneuvers in an attempt to prevent their $261-million-a-year business from being swallowed up by the much smaller Baltimore firm.

Gelfand said yesterday he had agreed to drop his opposition to the purchase because, "My only interest was to see that the shareholders and the employes are treated fairly. I'm satisfied that is being done."

The Gelfand and Goldman families together own about 23 percent of Macke's stock, 690,000 shares worth more than $10 million at the price Allegheny is offering.

Saying the Macke company has "been my whole career," Gelfand said he had not discussed with Allegheny whether he would remain with the firm after it is sold.

Allegheny spokesman Harry Conn said the Baltimore Pepsi-Cola bottler has "never contemplated any changes" in Macke's management. "We've never contemplated anything other than the present management continuing."

"As far as we're concerned, we don't have any excess management," added Conn. Allegheny's annual sales are only $129 million a year and the company is strictly in the soft drink bottling and distribution business. Although Allegheny does operate vending machines -- Macke's principal business -- the "overlap would not be that great," Conn acknowledged.

The acquisition of Macke would turn Allegheny into a half-billion-a-year business overnight and diversify the firm into several new lines of business, presenting major challenges for the Baltimore bottler. "It's been done before," commented Conn, "It's certainly possible if you have strong management."

In recent years, Allegheny's profits have been smaller than Macke's, but bigger as a percentage of sales. Last year Allegheny's sales of $129 million worth of Pepsi, Dr. Pepper, Dad's Root Beer, Schweppe's and High Rock sodas produced profits of $4.8 million -- 3.7 percent of sales. Macke's vending machines, D&F office furniture stores and Family Fish House restaurants earned $5.7 million -- 2.2 percent of sales.

Conn said Allegheny has negotiated a line of credit to buy the Macke stock, but is not yet disclosing the source of the funds.

The preliminary agreement announced yesterday by the two companies calls for negotiation of a definitive deal by Sept. 30 and a vote on the offer by Macke shareholders sometime after that. The purchase does not require the approval of Allegheny shareholders.

As part of yesterday's agreement, the two companies agreed to suspend actions in the lawsuits they have filed against each other and to dismiss the cases once the merger is completed.