Congress yesterday passed temporary appropriations to fund the government through Friday night as efforts to pass two bills needed to implement a $30.2 billion deficit reduction agreement became bogged down in disputes over funding the Nicaraguan rebels, Medicare savings and taxes.

Without the temporary appropriations bill, the government would have had to shut down at midnight yesterday when the existing stopgap funding legislation expired. President Reagan signed the two-day measure last night.

Though some congressional leaders are still predicting that Congress can complete action on the deficit-reduction measures in time to adjourn for the year this weekend, progress in settling House-Senate differences on numerous provisions in the two bills slowed yesterday. One of the bills is a $600 billion appropriation containing $7.6 billion in deficit reductions through cuts in military and domestic spending. The other, known as a budget reconciliation bill, combines $9 billion in tax increases with about $15 billion in cuts in programs such as Medicare and farm subsidies.

One serious obstacle emerged late yesterday when the Reagan administration demanded that a compromise on health-care spending offered by House Democrats be "dramatically modified." In a letter sent to four senators, Office of Management and Budget Director James C. Miller III charged that the House proposal would "exacerbate rather than solve the long-term deficit problem" by expanding programs in the 1990s, thereby adding $7.26 billion to the deficit in fiscal 1992.

Another serious obstacle appeared to be continuing nonlethal aid to the contra rebels fighting the government of Nicaragua. Rank and file House Democrats balked at a compromise proposal pushed by their leadership to give the contras between $5 million and $6 million through the end of February.

The leadership proposal would significantly scale back a provision adopted by the Senate last week that would give the contras $9 million plus as much as another $7 million to transport the aid, which would be limited to food, medicine, clothing and shelter. The House leadership compromise also would prohibit mixing previously authorized military aid with deliveries of humanitarian assistance.

Despite those assurances, a large number of House Democrats appeared ready to buck the leadership, which could imperil passage of the $600 billion spending bill unless it is supported by most Republicans.

"I think many Democrats are bound and determined to oppose one single red cent of contra aid, under any circumstances whatsoever, period," said Rep. Peter H. Kostmayer (D-Pa.).

A sharp dispute between the chairmen of the congressional tax-writing committees over Medicare payments to hospitals, meanwhile, threatened to undermine efforts to reconcile legislation cutting the health-insurance program for the elderly and disabled.

A provision in the House bill would revise the formula by which Medicare reimburses hospitals for the costs of caring for Medicare patients, effectively shifting more funds to hospitals in Illinois, Michigan, California and Massachusetts. Illinois would get $20 million in additional payments under the bill, while hospitals in southern and southwestern states would get less money. Texas, for instance, would lose $20 million, according to Senate sources.

House Ways and Means Committee Chairman Dan Rostenkowski (D-Ill.) strongly supports the proposal. Senate Finance Committee Chairman Lloyd Bentsen (D-Tex.) stands firmly against it and in favor of his committee's bill, which shifts more funds to rural hospitals. Both men have said the issue is important enough that they would oppose the ultimate compromise on the large tax-and-spending bill if the hospital provision goes against them.

"It's a straight pork-barrel issue," said Rep. Fortney H. (Pete) Stark Jr. (D-Calif.). "It's positively parochial."

Former Ways and Means Committee chief counsel Joseph K. Dowley is lobbying for the House bill on behalf of the Illinois Hospital Association. Proponents of the House bill said the adjustment would compensate hospitals that have higher costs of doing business, such as heating and snow removal. Opponents said the legislation is an attempt to subvert the reform of the Medicare system, which includes nationwide unified payment standards, passed by Congress in 1983.

Medicare and Medicaid, the health-care program for low-income people, were at the center of the dispute between Miller and House Democrats. In his letter, Miller said that the latest House offer to achieve savings in the two health programs and income-security programs were not sufficient to meet the requirements of the budget-summit agreement between congressional leaders and Reagan. Miller contended that the House proposal fell $300 million short in 1988 and $1.5 billion short in 1989. House negotiators responded that the nonpartisan Congressional Budget Office said their proposal complied with the agreement.

But Miller also accused House leaders of drafting provisions that would enact expansions of health-care programs in 1990 and beyond, after the two-year horizon of the summit agreement. "The bill actually increases the long-term deficit," Miller wrote. Hinting at a presidential veto, he added: "We cannot accept time-delayed expansions in either Medicare or Medicaid."

Bentsen also criticized House tax negotiators for failing to make any major moves toward the Senate in attempting to reconcile legislation that must raise $9 billion in taxes next year.

"Unless we see some substantial moves on the House side, we're going to be here for some time," he said.

The House made one major concession yesterday by offering to drop the most controversial of its provisions cracking down on tax advantages of corporate mergers and takeovers, which would have limited interest deductions on money borrowed to finance takeovers. Legislators retained one antitakeover provision, which would impose a 50 percent excise tax on stock gains by corporate raiders during takeover attempts.

House proposals submitted to the Senate yesterday accepted a number of minor compromises, but made few major concessions. The House sought to preserve its tax increases on defense and construction contractors and its expansion of the minimum tax on profitable corporations. The two chambers also differed on how to limit interest deductions for the increasingly popular home equity loans to loans of $100,000 or less.

Meeting late into the evening, senators responded to the House proposals by sticking to their own bill's provisions in a number of areas, including a controversial acceleration of corporate tax payments that Rostenkowski has vowed not to accept.

Despite the simmering rebellion over contra aid, eight of the 13 separate conference committees that are negotiating differences on the massive spending bill had either completed their work or were close to finishing last night. Among the major issues agreed to is a two-year ban on smoking on airline flights of two hours or less that would affect about 80 percent of domestic flights.

Agreement also was reached to permit the sale of shoulder-fired Stinger antiaircraft missiles worth $7 million to Bahrain. If, within 18 months, the United States can supply it with an alternate air-defense system, Bahrain would have to return any of the 70 missiles and 16 launchers it had not used.

Some major issues still remained unresolved, however, including foreign assistance to Pakistan, inclusion of a "fairness doctrine" that would force broadcasters to treat controversial issues in a balanced way, and the level of funding for the Midgetman missile.

Reagan also has said he will veto the spending measure if it contains the fairness doctrine.Staff writer Paul Blustein contributed to this report.