William J. Agee's corporate exploits have indelibly linked him with high-level office romance and the modern-day takeover brawl. Now the fabled executive has gained repute for something else: running a famous American company into severe trouble.

The 57-year-old boss of Morrison Knudsen Corp., an engineering-construction business that helped build the Hoover Dam, Golden Gate Bridge and Alaska oil pipeline, quit under pressure as chairman and chief executive, six years after the company hired him to salvage its loss-riddled operations. His resignation was announced Friday.

Although Agee at first steered Morrison Knudsen back to profitability, he appeared to lose his golden touch last spring, when the Boise, Idaho-based company began to lose money again.

Agee also was scorned by many Morrison Knudsen veterans, including the founder's widow, who accused him of arrogance and extravagances unbecoming of an executive whose company faced deep financial problems.

``All I can say is good riddance,'' said Velma Morrison, wife of Harry Morrison, after word of Agee's departure spread. ``It was terrible how bad the morale was. Everyone disliked him very much.''

The board said Agee resigned late Thursday. It moved quickly to replace him, installing ex-Reagan administration official William Clark as the acting chairman and promoting Stephen G. Hanks, an executive vice president of administration and finance, to acting chief executive.

The moves came a week after the company scrapped the shareholder dividend, projected weaker-than-expected earnings and said it might sell some businesses. At that time, the company also disclosed for the first time that Agee intended to retire sometime next year.

But the poor financial outlook intensified pressure on Agee to leave immediately. The company's stock price tumbled on the news and its corporate debt rating was reduced to one-notch above ``junk bond'' status.

Moreover, the bad news came against a backdrop of increased restiveness among some Morrison Knudsen directors, who were impatient with what they considered Agee's aloof management style.

He operated the company mostly from a satellite office set up near his home in Pebble Beach, Calif. There have been reports he used the company jet for private purposes before it was sold last summer and spent company funds on landscaping for his home and a painting of himself and his wife.

The company provided no official explanation for the management shakeup. Its board met Thursday in San Francisco where they considered Agee's fate.

Agee wasn't available for comment Friday. Morrison Knudsen spokesman Rod Hunt at company headquarters referred inquiries to its satellite office in Carmel, Calif. Susan Eden, a company official at the Carmel offices, said ``Mr. Agee has no interest in speaking to the press today.''

Suave and sophisticated, Agee won notoriety in the 1980s as chairman and CEO of manufacturer Bendix Corp. He made a bid for defense contractor Martin Marietta Corp., triggering a takeover fight that foreshadowed similar battles later in the decade. He lost the fight for Martin Marietta, and his job.

He drew even more attention for his relationship with an executive assistant, Mary Cunningham, who rose rapidly to vice president at Bendix and later became his wife. Cunningham's ascendance over others raised questions about Agee's motives and made high-powered office romance a front-page topic for awhile.

Agee was hailed as a savior when he joined Morrison Knudsen in August 1988. The company had lost nearly $60 million in 1987 and was headed to a $125 million shortfall for 1988.

Under Agee's direction, the company swung back into profitability in 1989 and posted earnings in the mid-$30 million range for each year he ran it except 1992 when an accounting adjustment resulted in a $7 million loss.

Some analysts said those profits were achieved mainly through asset sales, however, and masked a weak performance.

Agee's leadership came under fire in recent months as the company's financial troubles mounted. It posted losses in the second and third quarters of 1994.

One problem was that Agee shifted the company away from the construction project domain where it had historically excelled, and into building railroad cars and locomotives. He saw that as the future but that business has run into problems.

A broad shift into rail mass transit in this country hasn't happened yet, making Agee's vision a risky gamble. Moreover, some of Morrison Knudsen's existing contracts for rail cars reportedly have encountered quality-control obstacles.

At a meeting Friday with reporters in San Francisco, Hanks said Agee ``volunteered to resign'' but declined to answer whether he had been asked. He said a severance deal has not been worked out.

In trading on the New York Stock Exchange, Morrison Knudsen shares rose 62 1/2 cents to $10.25, well below the stock's 52-week high of $29.62 1/2 last April.