The federal government is about to impose on the nation's hospitals the strictest set of price controls in American medical history.

This uncharacteristic act by the Reagan administration was whisked through Congress almost unseen and unheard in a single month. The new rules--a set of flat fees for the millions of Medicare patients--were attached to the tamper-proof Social Security rescue bill, and were forced on the administration by congressmen of both parties in a desperate effort to control health costs to help preserve Medicare.

"It was now or never," said Sheila P. Burke, chief health staff aide of the Senate Finance Committee. Paul Rettig, staff expert on the health subcommittee of the House Ways and Means Committee, said, "Waiting meant too many amendments, too many favors to too many powerful interests and a Rube Goldberg bill which no one would go for."

The program will affect one-third of the patients and 40 percent of the income of the nation's hospitals and cause those hospitals to change drastically the way they do business.

One state, New Jersey, began a version of the plan in 1980 and this served as a model for the national controls program. "This has suddenly changed our whole mentality," said one New Jersey hospital administrator. "If we can't control costs, we'll go down the drain," said Sister Jane Frances Brady, president of St. Joseph's Hospital in economically pressed Paterson.

Backers say the plan is long overdue and, despite its blitzkrieg move through Congress, a thoughtful and logical first step toward bringing rampaging hospital costs under control and helping to save the $47 billion-a-year Medicare program from looming backruptcy.

Critics charge the controls could weaken the quality of care given the nation's elderly, making them second-class hospital citizens and lead to serious shifting of costs to private insurance companies with that tab inevitably being picked up by employers and workers who already pay the taxes that support Medicare.

Linda Jencks, executive vice president of the nation's major health insurance lobbying group, calls the plan "the lawyers' and accountants' relief act" because of the amount of government red tape hospitals now must unravel.

But the basic idea is simple, although its application may not be. Known in its full technical glory as "prospective reimbursement by diagnosis related groups," the plan divides all the ailments of Medicare patients into 467 categories, from arthritis to alcoholism, and sets a flat hospital fee for each.

It divides the nation into nine regions and subdivides these into urban and rural areas, establishing a different set of 467 rates for each area. There will be exceptions for some very sick patients and allowances for expensive teaching hospitals and other add-ons, but this is the basic idea.

Since the Carter years of bitter congressional debate over cost containment, hospital rates have soared dramatically ahead of the national inflation rate. The projected increases in Medicare costs have been even more frightening to those who hold the purse strings.

With the rising number of elderly, Medicare expenditures are expected to increase from $47 billion next year to $116 billion by fiscal 1992. Few on Capitol Hill or in the health-care industry believe the system can handle the load without the new changes, and probably more to come.

New Jersey's version of the plan is rather different than that enacted on Capitol Hill. The state has applied it to all hospital patients and not just Medicare patients, a huge difference. Many experts feel the federal program cannot work until it too covers all patients and doctors' fees, a possibility that federal officials are studying.

New Jersey nonetheless is the nation's only laboratory for the new payment method.

In the opinion of many health economists, New Jersey's experience is showing that its plan may at last force hospitals to hang onto patients as few days as possible, and give them only the tests and X-rays they need most, not every test possible.

Several New Jersey hospital administrators and officials made it clear last week that they are entering a new world, saying in interviews:

"In the past, putting it over-simply, we got paid on a cost-plus basis for all the care and tests that we gave" . . . "The more we did to you, the more money we got. The longer we kept you, the more we might make, because your last days with us cost us least" . . . "If we get paid only so many dollars for taking care of you, no matter what we do, the situation, and our incentives, are vastly different. We will lose money if we keep you too long and give you every test in the book. We may be able to make money if we get you out quicker, with less lab work."

Each New Jersey hospital has its own set of 467 fees for different kinds of patients. Although called "DRGs" for "diagnosis-related groups," they are simply prices.

Based in part on the hospital's past costs, in part on the average cost at other hospitals, they are the prices the hospital is allowed to charge the federal government, the state, Blue Cross, commercial insurors or the patient.

Millie Wojcak, 73, (true names of patients are disguised here,) was a recent patient at St. Joseph's. She had severe gall bladder disease and bronchitis. She was in the hospital 22 days for gall bladder surgery and further exploratory surgery, with an array of X-rays and other tests.

She fell into DRG 195, admission for "total cholecystectomy gall bladder removal with common bile duct exploration . . . age over 70, hospitalization for 8 to 32 days." A DRG 195 entitled the hospital to collect $6,689. But her care, according to a set of figures also approved by the state, cost the hospital $8,626, for a $1,937 loss.

Barbara Milletti, 81, was a DRG 125: "Circulatory disorder without myocardial infarction heart attack , with cardiac catheterization, with complex diagnosis, treated medically for 2 to 5 days." She was in the hospital just three days. Her care cost the hospital $1,249, but it will collect $1,418, the payment for all DRG 125s.

"So on this one, and others, we take a gain," said John Smalley, the hospital's assistant controller. "And on many we take a loss. The hope is to come out a little ahead at the end of the year."

What this new system has "done to us," New Jersey administrators said, is "something new and different" and "very interesting."

"First," Brady said, "it has forced us to calculate exactly how much each kind of patient really costs us. We had never done that before. So we can actually see our real costs and try to control them."

Second, she said, "We are no longer free to charge whatever price we want. So the system forces us look hard at how long we keep patients and whether we can't take care of them with fewer tests."

New Jersey inaugurated the system three years ago, starting with 26 of its 99 acute-care hospitals. It added the last group of hospitals only last July, so a complete financial assessment does not yet exist.

But a preliminary study of the first hospitals in the system indicates that their expenses rose about 3 percent less each year than the expenses of hospitals nationally. Expenses per "adjusted admission" (a figure including both bed patients and out-patients) rose 17.4 percent nationally but 13.9 percent in New Jersey between 1980 and 1981, Bruce Vladeck of the Robert Wood Johnson Foundation reported.

More recent and complete figures are not available. But Thomas Foley, president of Overlook Hospital in affluent Summit, said, "The state has been pretty generous with us up to now. They're just starting what they call a 'ratcheting down' to limit us to smaller annual increases."

At a conference last month at Washington's American Enterprise Institute, experts agreed that the New Jersey system may help hold down costs. One test, they said, for the new federal system and New Jersey will be overcoming what hospital people wryly call "gaming:" the ability of accountants to manipulate charges to realize the greatest profit.

One possible "game" is encouraging admissions of shorter-stay patients who may cost the hospital less.

"If I were an administrator outside New Jersey," added James Caldas, an Overlook Hospital vice president, "I'd hire the best cost accountants or consultants I could find to allocate costs away from Medicare patients to Blue Cross, Prudential, self-paying patients, et cetera. You look for procedures in the laboratories or radiology that are typically ordered for the older patient and depress the prices for those. And you inflate the charges for services typically ordered for the younger patient."

An even more severe test will be to control doctors' fees, which so far are almost entirely outside these flat-fee systems. Doctors, not hospital administrators, care for patients and order expensive X-rays and tests and complex operations.

There are other federally mandated mechanisms--hospital "utilization review" and "professional review" programs--to try to see that patients are not kept in the hospital too long or operated on unnecessarily to pad doctors' incomes. Nonetheless, said Alex McMahon, president of the American Hospital Association, the success of the new system "all depends on changing physicians' practices."

All the same, he said, the new federal system "provides a transition period" and "as time passes I think there'll be opportunities to modify" the new law.

Dr. Robert Rubin, assistant secretary of the U.S. Health and Human Services Department and a key architect of the federal plan, thinks businesses and insurors will help prevent abuses by negotiating with hospitals and doctors for employes or policyholders at cheaper rates. This is happening already in some parts of the country.

"What the federal government is doing is leading the way," Rubin said. "We're providing a mechanism we think will work best for Medicare and holding that up as a model that other payers can latch onto and adapt to meet their own needs."

Dr. Karen Davis, a deputy assistant secretary for health during the Carter years, believes the plan moved with such blistering speed and bipartisan blessings last month because Congress "just felt betrayed" by continuing promises that the hospitals would get their hyper-inflation, which has led other inflation rates constantly, under control without government help.

"They told us that if we the government would go away, the inflation would go away," Davis, now at the Johns Hopkins School of Public Health, said. "But it didn't. It got worse. The hospitals just couldn't get away with it and they knew it."

To help ease the shock to hospitals, the program will be phased in over the next four years, beginning in October. But, dealing with that amount of money and that many patients, hospitals face a host of dramatic changes.

Gary Boyd, government affairs director for the Fairfax Hospital Association group here, said most current hospital accounting systems are unable to analyze the specific cost of most of a hospital's services.

He warned that a flat-fee program, aimed at holding down costs, will be a major challenge to doctors, even though it does not cover their fees. "It flies very much in the face of what physicians have been told--to provide as many tests as seem indicated in the face of possible malpractice charges."

Across the land, hospitals are getting the first fuzzy explanations of the complex program from their Washington lobbyists.

"The lobbyists saw the handwriting on the wall and did the right thing," one congressional aide said. "They were trying to avoid something more painful. But I don't envy them now. They may have moved too far in front of their own constituents. I wouldn't want to be on this end of the phone when the hospitals start calling for an explanation of what just hit them."