Marathon Oil Co., fighting a takeover bid by Mobil Corp., yesterday reached agreement to merge with U.S. Steel Corp. at a purchase price valued possibly as high as $6.8 billion.

The proposed combination of the nation's largest steel producer and the Ohio-based oil company would be the second-largest merger in U.S. history and substantially betters the Mobil offer. The biggest corporate merger in U.S. history occurred earlier this year when DuPont purchased the Conoco Oil Co. for $7.5 billion.

Mobil, which bid up to $5.1 billion for Marathon, said yesterday it is studying the U.S. Steel offer and will have a statement after the offer is analyzed.

U.S. Steel offered to pay a minimum of $3.75 billion, or $125 a share for 3 million shares (51 percent of Marathon's stock). The steel company may also exchange bonds for additional stock and buy still more stock that has been authorized but not issued. If U.S. Steel exercises its options, this could increase the purchase price to approximately $6.8 billion. Mobil's offer was $85 a share.

The entry of U.S. Steel into the raging takeover battle could add huge new complications to the Marathon-Mobil fight, which is being waged in full-page newspaper advertisements, the Ohio legislature, various state and federal courtrooms and on Capitol Hill. Mobil may counter the U.S. Steel offer, or still another firm could jump into the bidding war.

But Marathon and U.S. Steel threw a provision into their agreement that clearly was designed to discourage Mobil and other bidders. Under the merger agreement, U.S. Steel has an option to buy most of Marathon's oil and gas reserves for $2.8 billion even if another firm acquires Marathon. The oil company's domestic reserves are one of its major attractions and the option clause may face challenges.

The proposed combination with U.S. Steel appeared to be better received than the Mobil bid on Capitol Hill, where concerns about possible antitrust implications of a merger between the nation's second and 17th largest oil firms have provoked concern.

But the proposed friendly merger with U.S. Steel raised other questions yesterday about the concentration of economic power and whether U.S. corporations are using tax breaks intended to increase production to make acquisitions that add nothing to industrial output.

Perhaps more than any of the recent wave of mergers, the Marathon controversy has served to focus broader concerns.

U.S. Steel would not say yesterday how it plans to finance the proposed acquisition, but the company's earnings statement for the third quarter of 1981 indicated that it has $2.5 billion in cash and lines of credit for $3 billion. Some of the purchase price would be future debt.

David M. Roderick, chairman and chief executive officer of U.S. Steel, pledged that the acquisition would not diminish the troubled firm's commitment to its steel operations. "Our investment in those operations will continue as planned," he said. He called the proposed merger the major diversification that U.S. Steel has been seeking.

"If U.S. Steel wants to use the resources of Marathon to strengthen its steel-making capacity, the merger might have some merit," said Rep. Clarence Brown (R-Ohio), one of the earliest critics of the proposed Mobil takeover.

But the U.S. Steel proposition met with harsher criticism from other members of Congress. "This is one of those dramas where we have only villains," said Rep. Tom Lantos (D-Calif.).

"We have the villain of Mobil, taking those tremendous profits and not using them to find one new barrel of oil . . . We have Marathon fighting righteously but offering its voluptuous sizes and shapes and attractions to Texaco. We have U.S. Steel not modernizing but using its resources to buy up Marathon and, again, not adding one barrel of oil to our energy independence," he said.

Rep Toby Moffett (D-Conn.) said "The issues involved here go far beyond the impact on the energy industry to fundamental questions about the use of corporate power and money in society and the economic concentration posed by that merger."

The proposed combination of U.S. Steel and Marathon also appeared to play better in Findlay, Ohio.

The small midwestern town where Marathon is the largest employer has rallied behind the home-town oil company in its fight against Mobil.

"The interests of our employes, customers and communities where we operate will be safeguarded because of the commitment of U.S. Steel to maintain our operations intact under the direction of Marathon's management with headquarters in Findlay, Ohio," said Harold D. Hoopman, Marathon's president and chief executive officer.