Exxon Corp. said yesterday it was withdrawing from all its operations in Libya, becoming the first American oil company to go along with reported U.S. government requests to cut ties with Libyan leader Muammar Qaddafi.

The Reagan administration is reviewing how it can pressure Qaddafi economically and politically to discourage Libya's military operations and alleged political subversion in Africa. Some government officials believe the United States should refuse to buy Libyan oil and make a more concerted effort to force the withdrawal of 2,000 Americans still working for U.S. oil companies there.

Last month, Sen. Gary Hart (D-Colo.) sought to amend the Foreign Assistance Act to ban U.S. imports of Libyan oil, but lost 60 to 33. Similar legislation has been introduced in the House.

Opposition to a boycott in Congress and the administration is based on the belief it would not be effective. Sen. James McClure (R-Idaho), chairman of the Senate Energy Committee, said this week that a boycott "would be a useful expression against Qaddafi but will not change events in Libya unless it is supported by our friends and allies."

Exxon confirmed its withdrawal but would give no reason for it. Industry analysts said the action probably was based on commercial considerations. Libyan oil has been priced so high that production has fallen sharply this year and companies have been losing money buying it.

Exxon, the world's largest oil company, has relatively small interests in Libya. It exported about 135,000 barrels of oil daily from Libya the first half of this year, but has exported no oil from the North African country since summer.

Occidental Petroleum and the Oasis Group, a joint venture of Marathon, Conoco and Amerada-Hess, account for most Libyan oil production, which last year averaged 1.8 million barrels a day but has been much less recently due to the worldwide oil glut. In each case, the Libyan government is the major partner.

Mobil Oil, operating with the Libyan government in another venture, temporarily halted production Nov. 1 but has not indicated it plans to leave.

Exxon's statement said, "We can confirm that Exxon has relinquished its concessionary interests in Libya by notifying the Libyan government. Exxon will withdraw from all operations in Libya.

"It is the desire of Exxon, and, we believe, that of the Libyan authorities, that Exxon's withdrawal be accomplished in an amicable and orderly manner. Discussions are under way with the Libyan authorities on arrangements for such a withdrawal. We have no further comment," the statement said.

About 75 Americans with 300 dependents are among the 364 foreign nationals Exxon employs in Libya. Last summer U.S. government officials first warned the oil companies to remove their personnel from Libya as relations between the two countries deteriorated. All U.S. diplomatic personnel were withdrawn in May, and Americans were warned not to travel to the country.

After his defeat on the boycott measure, Hart sent letters to the six American oil companies operating in Libya asking them to cease operations there, and to 32 companies that, according to Department of Energy records, have imported Libyan oil into the United States this year. Hart has received no commitments from the companies.

Exxon, whose concessions were in two oil fields, Velten and Reguba, in the northern part of the country, at one time produced 150,000 barrels of oil a day. It also produced 346 million cubic feet of gas daily from the fields in 1979, but only 232 million daily in 1980.

Occidental Petroleum, which produces 80,000 barrels a day in Libya, said it had no plans to stop operating there. A spokesman for Marathon Oil Co., whose share of the Oasis consortium's production is 17,300 barrels a day, said only, "We're keeping abreast of the situation." Mobil was producing and purchasing from the Libyan government about 30,000 barrels daily in the first half of the year.

Until the recent reunification of OPEC oil prices, Libya's high-quality crude was OPEC's most expensive at about $41 a barrel. It therefore was among the most difficult to sell. Its price has now been dropped to $37.50 a barrel.