The stunning, last-minute bid by Allied Corp. yesterday to end the merger battle between Bendix Corp. and Martin Marietta Corp. by buying both of them in a $2.3 billion deal is the most ambitious move of Edward L. Hennessy Jr.'s ambitious career.

It is perhaps not surprising, because he learned at the feet of two masters of the acquisition game: Harold Geneen of ITT and Harry J. Gray of United Technologies, where he worked before taking over at Allied.

Shortly after he became chairman of Allied Chemical Corp. in 1979, Hennessy told industry analysts that his goal was to double the giant company's earnings in five years. He tripled them in less than three.

Under his direction, Allied has shed its image as a stodgy manufacturer of industrial chemicals, plagued by the Kepone-dumping scandal of the mid-1970s, and become an aggressive, growth-minded company in which chemicals account for less than a third of its profits. The decision last year to drop the word "chemical" from the name was an appropriate signal of Allied's changing course.

In the first 30 months under Hennessy, Allied acquired 24 companies and folded them into its vast, diversified network of plants that turn out everything from auto batteries to "Captiva," a hot-selling new yarn used in what Allied calls "intimate apparel."

In a statement from Allied's headquarters in Morristown, N.J., Hennessy called the proposal "an excellent opportunity," saying Allied was particularly excited by the opportunity to acquire the aerospace electronics businesses of both Bendix and Martin Marietta to combine with its own electronics operations..

In the company's annual report to stockholders, Hennessy said Allied's "primary objective is steady, long-term growth in profitability," built on the basic strategy of increasing "the proportion of young, growth operations in Allied's business mix." Neither Marietta nor Bendix qualifies as "young," but both have product lines that are compatible with Allied's far-flung operations.

Hennessy's aggressive strategy has paid off in spectacular sales and profit growth. Last year, Allied reported sales of $6.407 billion, nearly double what they were in 1978 before Hennessy took over, and net income of $348 million, triple the 1978 figure. A few of Allied's divisions felt the impact of the recession, but most continued to grow, according to the annual report.

Though Allied is not widely known as an energy company, about a third of its revenues last year came from oil and gas operations. Through its subsidiary, Union Texas Petroleum, Allied has oil and gas operations in the North Sea, Pakistan, Angola, Abu Dhabi and several other countries. Union Texas also has a share of a major gas field developed last year in Indonesia.

Allied's biggest acquisition last year was the Bunker Ramo Corp., a manufacturer of electrical connectors and sophisticated electrical components, which it bought for $347 million after a long struggle with Fairchild Industries of Germantown.

Allied subsidiaries manufacture Mergenthaler typesetting machines, Converse athletic shoes, Prestolite auto batteries, seat belts, nylon carpet yarn, scientific laboratory apparatus, fertilizer, and soda ash. It also has a long history of manufacturing and operating nuclear power plants.

Allied's offer is subject to approval by its shareholders because an increase in the number of shares will be necessary to complete the merger. In addition to its cash offer of $85 a share for 13.1 million Bendix shares, Allied will offer a combination of its own stock and fixed-income securities for the remainder of the Bendix stock.

Allied has a $2 billion line of credit available to finance the merger, it said.

Bendix has agreed to sell Allied its aerospace electronics group -- not including the electrical connector business -- for $800 million in cash. This sale, subject to certain conditions, will occur whether or not the merger is completed, Allied said.

The merger, said Hennessy, "will do two things. First, improve the ratio of our domestic to foreign earnings, an important goal in our overall corporate strategy, and it opens up for our electronic business and new and fast-growing market in aerospace."

Allied could face some antitrust problems in a merger with Bendix because their product lines appear to overlap in some areas of the automotive and auto parts industries. There was speculation on Wall Street last night that it might be necessary for the merged company to spin off some of these units.

Hennessy, who is 54, appears to be an executive cut from the same cloth as Bendix's aggressive, acquisition-minded chairman, William Agee. Hennessy is the son of a Boston lumber salesman and a former women's professional hockey player. He is a former Golden Gloves boxer and once studied for the priesthood. He later graduated from Fairleigh Dickinson University in New Jersey, dropped out of law school, then devoted his energies to corporate management.

His avocations are sailing and work. He gets to the office so early, he once joked to an interviewer, that his wife thinks she married a milkman.