The clock was running down, billion-dollar deals were riding on whim and opportunity and the war for political hearts and minds had taken a frenetic turn.

In those final chaotic hours before Congress adjourned last month, the Carter administration and an array of powerful private and congressional forces locked into a quiet combat over high stakes.

The struggle had gone on for months in the House and Senate - but now, if by magic, the parliamentary moment seemed right. A chance had come to pass legislation to limit the fast-rising cost of hospital care.

The bill by then was not close to what Carter had wanted in April 1977, when he sent to Congress, with some fanfare, a proposal to limit increase in hospital costs.

But it was started and, with such enormous amounts of money involved, it was worth fighting for. And from the standpoint of the hospitals and doctors who opposed if from the beginning, it was worth fighting against.

Shortly before adjournment, the administration and a small band of allies coaxed, cajoled and muscle a modified cost-control bill through the Senate. The combatants turned to the House for a final showdown.

But the last fight, like the earlier ones, was an ilusion. The bill didn't have a chance. The same forces that thwarted Carter earlier sprang back into action and assured the new bill's death in the House. A few telephone calls, some well-aimed letters, some telegrams and that was it.

The anticlimax of those final hours of Congress seemed light years away from the early, high-energy days of the administration.

Carter had come to Washington with customary urgency of a new guard, full of ideas for change and putting the government to work for the people again after eight Republican years.

He would reshape the tax code, put a new face on welfare, inject some sanity into energy use. He would shake up the bureaucracy, make it more responsive. Foreign policy would be made openly, humanely.

The new president was talking about change, but he also was prescribing bitter medicine: higher fuel prices to reduce use, higher taxes on the privileged, curbing inflation, closing the public works pork barrel.

There was a certain electricity about Carter and his closest advisors whose government experience did not extend much beyond Atlanta. Inevitably they would comfront the guzmire of Washington.

One of those confrontations came over the hospital cost control bill, which Carter said would save the country $80 billion by 1983.

That bill, or some version of it, ultimately would win the approval of two House subcommittes, two Senate subcommittes, two Senate committees and the full Senate. But in many ways, Carter lost the fight before it had begun.

One reason was the proposal itself - a radical solution to a serious problem, a solution that threatened the medical industry in America but that stirred little public interest.

But there were other reasons behind the failure of the hospital cost-containment bill, as it was called and together they capsulized the story of the education of Jimmy Carter in the nation's capital.

It is the story of a new administration that challenged the Congress to deal with controversial ideas, but whose political skills, especially in those early days, brought miscalculations and missed opportunities.

But Carter found a Congress grappling with rapid turnover and internal reforms, a Congress that showed no particular fealty to party or leader.

This is also the story of a special interests, that Carter had attacked on the way to the White House. In this case the president encountered one of the country's most influential special interests - the medical lobby - which, used sophisticated strategy and money to help acuttle cost-containment.

It is useful to go back to the administration's early days, when Carter was capturing the public's attention with walks on Pennsyivania Avenue, firechats and telephone callings.

By the time Carter took office in January last year, his transition staff had made hospital cost-control a legislative priority and had sketched out a plan to achieve it. The issue took its place, although not at the top, on the administration's agenda.

But Carter was committed to the idea of returning executive power to his Cabinet. That meant that the hospital bill would be shepherded by the health, education and welfare secretary, Joseph A. Califano Jr.

Califano, in his aggresive way, rather symbolized the energy of the new administration. He had never run a department, never been a national leader for social reform, but he had been an advisor to President Lyndon B. Johnson and was credited with helping to devise the "Great Society" programs.

Califano wanted the bill passed and he wanted it quickly, with a little change as possible. He was in a hurry because the legislation involved billions of dollars - who would spend them, how, when and where.

That, some administration officials now concede, became a part of the problem. The Department of Health, Education and Welfare was still in its shake-down period, lines of authority were uncertain and Califano was pushing for quick action.

On its face, the appeal of dealing quickly with hospitals costs seems enormous. American spend roughly $160 billion a year on health care, about 9 percent of gross national product. Hospital take about 40 percent of every dollar.

At the time Carter came to Washington, medical costs were rising about 15 percent a year, almost twice the overall inflation rate. The cost of hospital services was rising even faster.

That inflation was adding $1 billion a year to federal, state and local Medicare and Medicaid expense. It was costing insurance programs and individuals almost that much more every year.

The problem is that most people don't notice Insurance of some form pays the largest share of the nation's hospital bills. Medicare covers the elderly; Medicaid the poor. Third-party carriers insure most of the rest of the public.

The Carter administration knew all this and recognized there was little public constituency for hospital cost legislation; but it also knew that the rising costs threatened Carter's campaign promise to propose national health insurance. Unless cost increases could be curbed, national health insurance had little chance of success.

The administration's solution was to put a lid of about nine percent increases in hospital revenues, a cap on new capital expenditures for some hospitals and incentives to improve the quality of care.

But miscalculations already had begun. A tone that one sensed in those days was of the administration telling Congress and the interest groups how things were going to be. The medical people and some of the key legilsators read that message into the hospital bill.

Califano and his top assistants argued privately about that. The bill was drawn up largely at HEW. Doctors and hospital administrators were kept out of it. Most members of the key committes in Congress were uncertain about the intentions of the bill and the administration's commitment.

"The administration could have made it less unattractive," said a Senate health aide. "They could have called in the hospitals and the doctors, told them there was a problem with costs and then asked how to structure this so we could move. But they didn't."

One of Califano's top advisers added, "We told Joe that the Hill is different now and the first thing you do is consult widely. We called all these people in at the beginning but Joe wouldn't meet with them, so the whole dialogue died. The difficulty wasn't understood here."

Comments of that sort typify a general feeling about Califano's style - that he rubbed the medical lobby the wrong way because he is outspoken, uncompromising and sometimes abrasive.

"He almost intentionally invites controversy," said another congressional health aide. "You can predict what he will do by looking back at the 89th and the 90th congresses. Asked what Lyndon Johnson would have done then and Califano will do it the same way today."

If Johnson, with his personal style of arm twisting and his knowledge of the congressional by ways, could bully a bill to passage in the 1960s, it can't be done that way in the late 1970s.

But Califano seemed to enjoy his attack posture. He blistered the hospitals with statements about their waste and mismanagement. He decride their zeal to buy costly, sophisticated equipment that wasn't needed. He talked provoctively about their lust for the "candy" and "dessert" of more income. But he excited none of the people he intended to excite.

Instead, Califano stirred up the opposition. Doctors and hospital officials felt they were under attack and resented that they were being told, rather than consulted, about how to run their business.

Organized labor wasn't happy, either. Carter had said the mandatory controls would not apply when wages for low-salaried nonsupervisory employes were raised. But the HEW bill, due to what Califano calls a misunderstanding, didn't provide that exemption and the AFL-CIO was against the bill in the beginning.

Califano and his aides at HEW rankled at the criticisms, but they had other problems on the Hill. The secretary's "us-against-them" style, as one staffer called it, hurt the feelings of some legislators and alienated others, who felt they owed no favors to Califano or Carter.

And then there was the medical lobby - by itself, without provocation, a formidable influence on Congress. But it had another tool at hand - a custom-built network, reaching into every congressional district, only waiting for the right shove to be activated.

A hospital, of course, is not just a building. It is a major employer and buyer of services in most communities a respected institution. Its frustees often are the most influential people in town.

"Any time any segment of the economy is threatened with legislation of this kind . . . there is no problem to organize opposition," said J. Alexander McMahon, president of the American Hospital Association. "The bill was so bad, it so misread the problem, that it was relatively easy to attack. And attack we did."

This was what awaited Carter and Califano after they appeared in the White House press room on April 25, 1977, to unveil their plan. They were asking a lot. Only five days before, Carter had declared the "moral equivalent of war" in behalf of his energy packages.

His war soon would explode on several fronts.