Congress yesterday passed stopgap legislation to let the goverment keep borrowing and stay in operation beyond midnight Saturday, but leaders first had to promise fractious members that they will have a chance to vote next week to kill President Carter's oil import fee.

While it took care of most of the government, Congress neglected the agency that has been its favorite punching bag this year, the Federal Trade Commission. It failed to pass an FTC money bill, and for the second time this year that agency will have to shut down temporarily Monday for lack of funds.

The oil import fee would raise gasoline prices 10 cents a gallon. Leaders have been trying to protect it from a resolution of disapproval, which would kill it. Opponents then moved to attach such a resolution to crucial legislation extending the federal debt ceiling for five days, on the theory that this would protect it from a veto. Without a debt ceiling extension, some said the government would lack authority to issue Social Security checks next week.

In the day-long maneuvering over the debt ceiling bill, congressional leaders conceded that opponents of the oil import fee have the votes to kill it and probably the two-thirds vote necessary to override a presidential veto.

"You are oging to win that battle," said Senate Majority Leader Robert C. Byrd (D-W.Va.) in explaining the agreement under which opponents of the fee consented to delay their fight until next Wednesday, when another debt ceiling measure will be considered.

Congress must periodically raise the debt ceiling to preserve the government's borrowing authority.

This year the deadline is Saturday midnight, and the problem is compounded by the fact that an increase in the debt ceiling to a total of $934.4 billion is included in the 1981 budget resolution, which the House rejected Thursday night and sent back to conference. This necessitated a temporary extension of the current ceiling of $879 billion until the budget resolution passes.

When House leaders tried to pass a 30-day extention on Thursday, Rep. Robert E. Bauman (R-Md.) and several liberal Democratic opponents of the import fee blocked them.

House Rule Committee Chairman Richard Bolling (D-Mo.) then promised to consider scheduling a vote to repeal the fee on June 10.

But Bauman and his allies demanded more, and House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) agreed on the House floor to a guaranteed vote on repeal in exchange for a five-day extension on the debt ceiling, which would get the government through the early part of next week.

Bauman finally relented, comfortable in the knowledge that Sen. Bob Dole (R-Kan.) and other Senate foes of the fee would have an even easier opportunity to attach the resolution of repeal when the debt measure came before the Senate later in the day.

After several hours of negotiations with Dole and his allies, Byrd won unanimous consent to pass the debt measure on the understanding that he and O'Neill would permit a vote to attach the repealer to a second debt extension bill next Wednesday.

The fee was imposed by Carter last March but was blocked from taking effect this month by a federal court ruling that is being appealed by the administration. A hearing on the appeal is scheduled for June 9, and the fee's opponents said they want a congressional action before the appellate court has an opportunity to reinstate the levy.

When Congress failed to meet its latest deadline in providing needed operating funds for the FTC, notices of "suspension of normal activities" went out to FTC offices. The agency has been operating for months under stopgap authority as part of a congressional power play over legislation spelling out its powers.

That legislation has been agreed to, but the agency's money runs out tonight, and Congress didn't complete work on a new appropriations bill yesterday.

The Justice Department ruled last month in a similar situation that the FTC could not function without an appropriation and the agency closed down for one day.

The House voted $49.7 million yesterday to carry the FTC through the end of the fiscal year ending Sept. 30, but the bill ran into procedural trouble in the Senate.

The issue was put off until Monday.