As the federal bureaucracy entertained the unthinkable thought of turning into a pumpkin, the Senate yesterday passed a stopgap funding bill to keep the government operating after the new fiscal year begins at midnight tonight.

The Senate's version of the measure -- called a continuing resolution -- was then sent to conference with the House, which passed a different version earlier this month. But the House delayed naming its conferees, postponing the first conference session until this morning.

"If we don't get this bill [the continuing resolution] through in 36 hours, all government will stop," said Senate Appropriations Committee Chairman Warren G. Magnuson (D-Wash.) in an apocalyptic warning to his colleagues earlier in the day as they dallied over an antiabortion rider to the resolution.

In the end, the Senate moved closer than ever to the strongly antiabortion position of the House, which would make it easier for the conference to resolve differences in the two versions of the resolution.

But if this or any other issue prevents final passage of the continuing resolution by midnight, most of the government and its 5 million military and civilian workers technically will b without money to do anything more than execute an orderly shutdown of operations.

As of late yesterday there was no clear word, however, about what services might be exempt and for how long. A spokesman for the Office of Management and Budget said the government could still incur obligations to "protect life and property," presumably covering most Pentagon operations, and to carry out ongoing entitlement programs such as Social Security.

But an official of the Office of Personnel Management said that clerks, for instance, could not be paid to send out Social Security checks. Moreover, the official said, no agency is immune to at least partial shutdown. m

So mind-bogging is the idea of a total government shutdown that few officials on Capitol Hill or in the bureaucracy think it might happen. Congress has to act on time, according to their reasoning, because the alternative is so preposterous.

The problem is this: the fiscal year ends at midnight, Sept. 30. After this point, agencies are without funds to carry on their operations unless Congress has appropriated new funds for the new year. As of now, only one appropriations bill -- the one dealing with energy and water projects -- has been passed by both houses.

Congress has gone to the brink on government funding in the past, but usually the money continued to flow. However, Attorney General Benjamin Civiletti, in a strict reading of an old law, recently ruled that agencies can no longer continue to incur obligations after their appropriations expire. As a result, the Federal Trade Commission had to shut down earlier this year for a few days when its temporary funding expired during a congressional dispute over its powers.

The Office of Management and Budget issued a standby shutdown directive last August, and each agency is supposed to have drafted its own contingency plans, according to an OMB spokesman.

The continuing resolution would keep money flowing to all agenicies at current or slightly increased levels through Dec. 15. This would enable Congress to fund the government for long enough to recess for the fall campaign and then return in lame-duck session after the Nov. 4 elections. At this point, it could pass the actual appropriations bills or even extend the continuing resolution until early 1981.

In its action on abortions, the Senate agreed with the House to permit states to go beyond Congress in restricting federally financed abortions for poor women. Conceivably, states could refuse to permit any such assistance.

Congress currently limits abortion aid to cases where a woman's life is endangered or to cases of rape or incest. The House-passed resolution would restrict aid only to those cases involving jeopardy to the woman's life. The resolution passed yesterday by the Senate retains the rape-or-incest provision.