President Reagan shut down part of the federal government for several hours yesterday, sending 500,000 workers home at midday as Congress wrangled with a spending bill for two-thirds of the government. By nightfall, a 36-hour extension was approved and the White House said workers should return to their jobs this morning.

The shutdown touched off a day of partisan finger-pointing. Hours after ordering the shutdown, Reagan blamed Democrats for it, saying, "You can lay this right on the majority party of the House of Representatives."

Democrats quickly fired back, saying the Republican-controlled Senate had stalled the spending bills and accusing Reagan of staging a dramatic but unnecessary "Hollywood publicity stunt" three days before his first presidential debate with Democratic nominee Walter F. Mondale.

Reagan signed an order closing down eight departments and dozens of federal agencies yesterday morning, concluding that it was unlikely that Congress would unsnarl the spending impasse by day's end.

A half-million government workers nationwide -- 100,000 of them in the Washington area -- were given three hours to clean off their desks, cancel their meetings and go home. From here to Anchorage, public museums were operating with reduced staffs, telephone answering machines were turned on and makeshift placards were posted at entrances to federal office buildings.

Later in the day, the Senate and House approved the 36-hour extension even as they continued to try to iron out differences over a 12-month spending bill that still may face a presidential veto. The White House said that Reagan is expected this morning to sign the temporary extension, which expires at 6 p.m. tonight, and that all workers should return to their offices today.

It was the second time the government had ground to a halt over such a spending impasse; Reagan ordered the first shutdown in November 1981 at a cost, in lost time and paper work, that Congress later estimated at $65 million. The administration said yesterday that workers were told that they were being furloughed without pay for the time lost. After the last shutdown, however, Congress voted to pay them anyway.

Workers deemed "nonessential" in the departments of Health and Human Services, Interior, Labor, Education, Transportation, Defense and Agriculture were furloughed yesterday, in many cases shortly after arriving, and Metro subway trains operated on an early rush-hour schedule.

But employes at the departments of State, Commerce, Justice, Housing and Urban Development and Energy stayed on the job, because Reagan has signed money bills to keep them operating for the new fiscal year, which began Monday.

The administration also kept on the job "essential" employes such as the president's top assistants, some of whom spent part of the afternoon helping him prepare for Sunday's debate with Mondale. Others who remained at work included military personnel, the Secret Service, the Coast Guard, public health workers and Social Security workers -- so the flow of checks to retirees would not be interrupted.

The shutdown touched off a day of partisan bickering that reflected political calculations in both parties that the disruption could fuel a rhetorical cross fire over government spending during Sunday's critical presidential debate.

At midday, as workers streamed home, Reagan assembled about 200 GOP members of Congress and congressional candidates on the steps of the White House for a picture-taking session and began blasting at Democrats, as the Republicans applauded with zeal.

Asked why he ordered the shutdown, Reagan said: "It is an extension of what has happened ever since we've been here. You can lay this right on the majority party of the House of Representatives. Just once it would be great to have a budget on time."

He did not mention that the latest stall over a catchall spending bill for the next year had occurred in the Republican-controlled Senate.

"He's just not telling the truth," protested House Majority Leader James C. Wright Jr. (D-Tex.). "I don't know whether he deliberately misstates the facts or he just does not know any better." Wright called Reagan's statement "inaccurate in the extreme."

House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) accused Reagan of "embarrassing his office by using the presidency to engage in a Hollywood publicity stunt."

"He stopped the government today not for purposes of good public policy but for purposes of melodrama . . . . By pulling the curtain on the government, the actor in the Oval Office is making his final grab for an Oscar," O'Neill said.

He added: "The record shows that the House passed the budget on April 5. For six months, the president tied up the budget process by refusing to accept a compromise on Pentagon spending. As for appropriations, the House had passed 10 of them by Aug. 2; the Senate had passed half that number."

Echoing a fear shared by other lawmakers, Rep. Tony Coelho (D-Calif.), chairman of the Democratic Congressional Campaign Committee, said Reagan was trying to take credit for good news and blaming Democrats for the bad.

"The public will accept the idea that Congress is Democratic and it's the president versus Tip O'Neill. Going into the election, Reagan wants the confrontation to be between him and the Democratic House and not between him and Mondale or between him and the issues," Coelho said.

"It's the Republican-controlled and -dominated Senate that is at fault," he said. "We've been waiting for them for a week."

Reagan's decision to order the shutdown and point his finger at House Democrats follows a pattern in which he repeatedly has blamed Congress for fiscal disruptions and the deficit. Polls consistently show that Congress is held in lower regard than churches, the military, banks, the Supreme Court, public schools and newspapers. Reagan yesterday appeared to be taking advantage of this perception and faulting not only the Democrats but Congress as an institution.

Senate Minority Leader Robert C. Byrd (D-W.Va.) pointed out that, notwithstanding Reagan's complaint, the House approved the big continuing resolution Sept. 25. Byrd ridiculed Reagan, saying the Senate calendar is "too large to fit on a . . . 3-by-5 card" like those Reagan uses.

Even as the partisan sniping intensified, the White House held out the possibility that Reagan would veto the 12-month continuing resolution that provides money for most of the government. The Senate passed the big money bill yesterday; House-Senate conferees met last night to begin reconciling their many differences on the measure. White House spokesman Larry Speakes said Reagan objected to extraneous measures -- particularly a series of politically sensitive water projects attached by the House.

The current crisis arose Monday, the start of fiscal 1985, with Congress having approved, and Reagan having signed, only four of 13 regular appropriations bills needed to keep the government running. With the Senate bogged down in debate on civil-rights legislation, Congress voted a three-day extension with a short continuing resolution, which expired at 12:01 a.m. yesterday.

House and Senate leaders wrangled over whether to adopt another short-term money bill, but had not done so by early yesterday morning when Reagan met with his aides. Presidential spokesman Larry Speakes said Reagan was told that there was "no guarantee" he would get a spending bill by day's end and that a little-used law required him to order the shutdown.

The Anti-Deficiency Act, passed during the administration of Ulysses S. Grant, requires the government to close down if money for departments is not appropriated. In the past, presidents have chosen to ignore the law for short periods when it appeared that a money bill was imminent. But Reagan invoked the law in 1981 and again yesterday to force a shutdown.

Democrats contended yesterday that Reagan could have averted the shutdown, noting that he waited two days to sign the temporary money bill approved on Monday. Speakes said Reagan had no other option because Congress had not agreed on the huge spending bill.

Aides to O'Neill said the White House had told them that Reagan would not decide until noon whether to order the shutdown.

But White House officials noted that the Senate, after a marathon 22-hour session, was not scheduled to reconvene until after 2 p.m. -- leaving Reagan little choice but to send government workers home.