The Democratic House and Republican Senate both defied President Reagan yesterday and approved a huge government spending bill that he vowed only hours before to veto, plunging the government into an extraordinary stalemate.

The House vote was 205 to 194, the Senate's 46 to 39, in neither case enough to override the veto the president promised today.

The dramatic confrontation between Congress and the White House involved only about $2 billion out of $428 billion in stopgap appropriations for nearly all the federal bureaucracy.

But it left most of the government without spending authority, even though Congress seemed poised to provide emergency funding quickly today. Leaders of both parties were planning such action last night, but they disagreed over how long the emergency authority should last.

Even as Congress was moving toward the veto stalemate, the White House moved to dramatize the possible consequences.

Deputy press secretary Larry Speakes said there would be an 8 a.m. Cabinet meeting at which he said Reagan would ask department secretaries to order nonessential employes to "come to work, cancel meetings, lock the safe, cut out the lights and leave." Speakes said one-third of the White House staff would be laid off without pay by noon and estimated that 400,000 government workers could be laid off without pay by the end of business Tuesday.

On Capitol Hill, Democrats accused Reagan of seeking headlines and a personal victory over a relatively minor amount of money at the expense of orderly operations of the government. During the House debate, Majority Leader James C. Wright Jr. (D-Tex.) said he had no idea why Reagan would veto the bill "unless the president simply wants the theatrics of bringing the country to a halt."

Lost in the shuffle as the House completed its action on the multibillion-dollar "continuing resolution" were pay raises for 46,000 government executives whose salaries have been frozen since 1979. The House refused to lift the pay cap, which had been tied to a pay raise for House members in a way that virtually assured its rejection by a House that is always skittish about raising its own salaries.

Meanwhile, government employes are required to go to work today regardless of the shutdown that is to begin right after they arrive. Work is to be restricted to orderly suspension of all activities except for duties related to national security and the "safety of life and property."

Although the House vote was largely along party lines, with Democrats supporting the measure and Republicans opposing it, the Republican leadership in the Senate appeared to be trying to find the quickest, least damaging way out of the executive-legislative confrontation. "To tell the truth . . . I don't care which way it goes," said Senate Majority Leader Howard H. Baker Jr. (R-Tenn.) in exasperation at one point. "I just want to get this thing out of here . . . you can vote it up or vote it down. Just vote."

The government has been in technical insolvency since 12:01 a.m. Saturday when earlier stopgap funding expired without passage of regular appropriation bills, and congressional leaders worked through the weekend to produce a compromise further stopgap bill that would meet Reagan's demand for big new spending cuts.

They thought they had one shortly after 1 a.m. yesterday when House-Senate conferees approved a compromise that they claimed matched or exceeded the dollar savings that the Senate had proposed earlier in the week--a plan that the administration had indicated was acceptable.

But after Reagan's Office of Management and Budget computed the numbers in the bill, the president called Baker and House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) around midday yesterday to say the savings were too small and to inform them that he intended to veto the measure.

Asked if a veto might force a shutdown of the federal government, Reagan later told reporters, "I think it would have a more harmful effect on the country if the country got the idea that we are going to continue right down the road of lavish spending."

Referring to the fact that Congress kept many agencies on stopgap funding through the last fiscal year and has passed few of the regular appropriations bills so far this year, Reagan added: "The fact that this country has gone on now for a year without a budget and two months into the second year without a budget, that is no way to run a railroad, and it's even less of a way to run a country."

In response, Democrats blamed Reagan for the crisis, accused the administration of using phony figures and chided the president for pushing for more than $1 billion in increased funds for foreign aid while advocating cuts in domestic social programs.

Even some Republicans plaintively urged Reagan to reconsider his veto plans. The administration should not "roll the dice over disputed outlay estimates when the stakes are so high," said Rep. Silvio O. Conte (R-Mass.), ranking minority member of the House Appropriations Committee.

In telephone conversations with Baker and O'Neill, Reagan proposed that stopgap funding levels that expired last week be reinstated and extended for 15 days--enough to get him and Congress through the Thanksgiving holidays before resuming their struggles over spending levels for the fiscal year that will last through Sept. 30, 1982.

But the House, with its Democratic majority claiming that Reagan was welshing on earlier indications that the new spending levels were acceptable to him, ignored the request and approved the conferees' continuing resolution proposal, 205 to 194, splitting largely along party lines.

The narrowness of the vote virtually assured that the House would sustain Reagan's veto of the measure, meaning that Congress would have to come up with a new proposal or resort to the kind of temporary extension that Reagan proposed in order to keep the government running this week.

It is possible that quick action by the House and Senate to approve a temporary extension of the old spending authority could get the government back in business later in the day, with little disruption of its normal activities.

However, as of last night there was a dispute between the Democratic majority in the House and the Republican majority in the Senate over how long the extension should last. Senate Republicans were pushing for Dec. 15 as an expiration date, while House Democrats wanted Feb. 25.

The old levels permit domestic spending at a higher rate than Reagan wants, while denying him the military spending increases that he has sought.

Congress has missed its deadline for spending resolutions before, creating confusion as one or more agencies tried to operate for hours or even days with the money spigot turned off. But never before has the politics of the dispute been so intense or the likely impact of a stalemate been so sweeping. This time almost all the government, from the Pentagon to the biggest domestic agencies, have been operating without their routine appropriations bills in place--meaning the entire executive branch is vulnerable to varying degrees of shutdown until the dispute is resolved.

Reagan's OMB contended yesterday that the conferees' compromise counted as savings between $1.7 billion and $1.8 billion in cuts from entitlement programs such as food stamps, veterans' assistance and black lung benefits that will have to be funded by a supplemental appropriation if money for the program runs out. Thus, they cannot be counted as real savings, OMB maintained.

Reagan had wanted $8.4 billion in domestic appropriations cuts as part of his "September offensive" for budget reductions to keep down the federal deficit, but later indicated he would meet Congress "half way" and accept a $4 billion cut.

As the conferees' compromise turned out, including the counting of entitlement cuts, the actual savings was about $2 billion, according to OMB spokesman Edwin Dale. "So the president, in effect, was being asked to accept only a quarter-loaf," said Dale.