The Senate voted yesterday to forbid new import fees on foreign oil, which President Carter has said he may impose if Congress rejects his energy tax on domestic crude oil.

The action could be a serious embarrassment to Carter, who told members of Congress last week that he is considering announcing at an economic summit meeting in Bonn next month that if Congress dosen't impose the discipline of an oil-saving energy program on the nation, he will do so by administrative action such as import fees to force up oil prices.

The issue now goes to a conference between the Senate and the House, which has not voted for it.

U.S. trading partners who will gather at Bonn are anxiously awaiting enactment of an American energy policy because of the economic impact on them. If the United States can reduce its oil imports, the balance-of-trade deficit would shrink, the dollar would grow stronger abroad and foreign goods would be cheaper and easier to sell in this country.

The Senate vote yesterday came on an amendment to a $9 billion appropriation bill for The Treasury Department and the Postal Service.

In other action on the bill, the Senate followed the lead of the House in slapping a pay freeze this year on federal officials earning more than $47,500 a year and putting a ceiling of 5.3 percent on all other pay rises. By 54 to 34, it also approved a 2 percent cut on all appropriations in the bill, except for the Postal Service.

It was 14 months ago that Carter sent Congress an energy package as his top legialative priority. It is still stalled in a House-Senate conference.

The centerpiece was a tax to force up the price of domestic crude oil to world price levels. It was approved by the House but rejected by the Senate, and most observers think it cannot be received in the strong antitax climate of this election year.

A White House official characterized Carter's reaction to yesterday's Senate vote as "mild disgust." The official, expressing confidence that the impasse will be resolved, said a veto of the bill was a possibility if the Senate provision remains in the measure.

Press Secretary Jody Powell said, "It's the president's feeling that this is just another unfortunate demonstration of a desire to duck a tough problem and why we are still the only industralized nation in the world without a national energy policy."

For months Carter has been urged by his fiscal advisors to impose import fees on foreign oil, as he is empowered to do, as an alternative to the domestic crude oil tax.

The effect would be to raise further the price of imported oil, which has quadrupled in the last five years, and to raise the price of all oil consumed in the United States.

Carter last week called the energy conferees to the White House and asked what the congressional reaction would be to an import fee. Several came away feeling that Carter had virtually decided to take this step. Yesterday's vote was the first congressional response.

The amendment offered by Sen. Bob Dole (R-Kan.) would forbid the import fee program, from spending any money provide by the bill to do so. A motion to kill the proposal by tabling it was rejected, 49 to 39, and the provision was then adopted by a voice vote. Dole had also succeeded in adding to the energy tax bill a provision to repeal the president's power to impose import fees in peacetime, but that never was put to a vote by the Senate. The House has not voted on the issue.

Senators from the Northeast, which depends heavily on imported oil, cast the votes that made the difference. Most of them usually can be counted on to support Cater, but most voted against import fees.

"The president would sacrifice my people to send a message to the Europeans," said Sen. John A. Durkin (D-N.H.).

Dole argued that a fee raising import prices above present world prices would be a signal to oil-producing countries that the United States could stand another increase in prices by the Organization of Petroleum Exporting Countries.

Sen. Henry M. Jackson (D-Wash.) pleaded with the Senate to reject Dole amendment. It would, he said, only "tie the hands of the United States" just as the president is about to meet with world leaders who are already concerned about the inability of the United States to adsopt a national energy policy.

Sen. Herman E. Talmadge (Ga.), ranking Democrat on the Senate Finance Committee in the absence of Chairman Russell B. Long (D-La.), called it a "tragic mistake to tie the president's hands" with a rider on an appropriation bill.

Talmadge also announced that the energy Tax conferees, which have not met this year, will reconvene July 13 on the eve of Carter's departure for Bonn. Whether or not the conferees accomplish anything, the president will be able to tell the Bonn meeting that they are at work.

Congress is on the verge of sending some of the smaller pieces of Carter's energy bill to him for signing. Conferees have agreed on weekend versions of Carter's proposals to force industrial conversion to coal, and revise electric utility rate structures to save energy, as well as a series of other conservation measures. The conference report on one or all of these may clear the Senate before Carter goes to Bonn.

The conferees also have agreed to remove price controls from newly discovered natural gas by 1985. That is expected to provoke a Senate filibuster in a month or so.