Congress yesterday approved three-day emergency funding to avert shutdown of many government agencies today as the House and Senate scrambled to revive a catchall spending bill that was killed by a rambunctious House late Monday shortly after funds ran out.

Even though the agencies were technically out of business yesterday, the White House ordered workers to stay on the job while Congress considered stopgap funding to continue operations while a new spending compromise is worked out.

The House, subdued after its rebellion of the previous evening, voted 334 to 74 early in the day for a bill to tide the agencies over until midnight Thursday.

The Senate followed suit after some delay, passing the measure by voice vote in early evening and sending it to President Reagan, who signed the measure last night.

Some western-state senators had balked at a moratorium on spending by the Synthetic Fuels Corp. that the House tacked on to the stopgap measure.

The long-term measure would kill the synfuels program, but many lawmakers feared the quasi-independent corporation would obligate spending of up to $1 billion before the spigot is turned off. Senators with projects in the pipeline had been holding out for language that would allow their projects to be approved.

While the administration was "sufficiently assured" that funding would be restored to keep workers on the job yesterday, nonessential employes of agencies without funding had been ordered to stay home today if the stalemate continued, presidential spokesman Larry Speakes said.

But with passage of the stopgap measure, normal operations will continue until at least Friday, when congressional leaders hope to have passed a long-term bill. The catchall funding is needed because only six of the regular 13 appropriations bill have been signed into law for the current fiscal year; the others are pending on the Hill.

Agencies covered in the stopgap measure include the departments of Defense, Treasury, Agriculture, Interior and Transportation as well as the General Services Administration, the Office of Personnel Management and the White House.

As congressional leaders worked on stopgap funding, House-Senate appropriations conferees worked privately to resolve defense and other disputes that led to the surprise House vote of 239 to 170 against the long-term spending measure Monday night.

Democrats split over passage of the measure and Republicans voted 2 to 1 against it.

Liberals were upset over defense spending increases and weaponry victories won by the Defense Department; conservatives complained that domestic spending levels were too high; lawmakers of all persuasions got jittery over the political embarrassment of proposals that could lead to compensation increases for themselves. There were also more parochial concerns, including loss of highway funds to states that do not raise their drinking ages to 21.

Republicans and Democrats also complained that the administration, preoccupied with garnering votes for tax-overhaul legislation, failed to rally GOP votes for the spending bill, even though it got more for defense in that measure than it is likely to get in a new compromise.

The rejected measure included $298 billion for defense, along with $6 billion in transfer funds to cushion the Pentagon against future budget cuts in the Gramm-Rudman-Hollings deficit-reduction act.

The problem with a new compromise is that any concession to one group is likely to alienate another group, with the additional risk of provoking a veto if it is regarded by the White House as providing too much for domestic programs and too little for defense.

"It's a very tight rope they're walking down there," House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) said.

Conferees were reported late yesterday to be considering a compromise that would include a reduction of about $2 billion from the defense section of the bill, along with some of the weapons procurement revisions that the House wanted. Many House members were also demanding elimination of a Senate-sponsored provision under which senators could earn up to $30,000 a year in speechmaking fees, an increase of $7,500 over the current limit.

Many were also nervous about provisions that would make it harder to block a congressional pay raise after next year's elections fearing the issue could be used against them by campaign opponents.