President Carter and Sen. Russell B. Long (D-La.) are moving quickly toward agreement on a national health insurance plan that would freeze out Sen. Edward M. Kennedy's (D-Mass.) more ambitious proposal.

Long, chairman of the Senate Finance Committee and considered the key in the Senate to passage of any health insurance bill, said yesterday that he could vote for a $20 billion package much like the one Carter proposed Tuesday.

His surprising statement came in an interview in which he also said, for the first time, "I'll be voting with the president on [ hospital] cost containment." This means he would support a bill that so far has been stalled and that goes far beyond the much weaker one backed by Long's close friend, Sen Herman E. Talmadge (D-Ga.).

Long's revelations mean there could be a good chance this year or next for a health plan that would please both Long and the president. But it would deal out not only Kennedy but also organized labor and other supporters of a total national health plan.

Until now, most political observers have believed Long was willing this year to back no more than a bill creating maybe $5 billion to $7 billion worth of insurance for the catastrophic illnesses that outrun ordinary health coverage.

But Long told the president in a one-hour meeting on June 6 that he would back him as far as possible on health insurance and hospital cost controls, Health, Education and Welfare Secretary Jospeh A. Califano Jr. disclosed.

"I have spent hours with Long" talking about health insurance, and "the things he said on a health bill" yesterday are "the same things he said privately," Califano added in a telephone interview.

Taken with the latest views of many other senators. Califano said, "Sen. Long's position reflects the fact that we are closer to a consensus on health insurance than at any time since we passed Medicare and Medicaid in 1965."

"Long's position figures," one Hill healthwatcher said. "Long wants a health bill and the president wants a bill and Kennedy wants a bill. You don't think either Carter or Long wants to help Kennedy at this point, do you?"

A Kennedy aide warned that Long at some point could retreat again to a less expensive plan than the president's, and say he was doing it to win Republican votes.

Republican votes will probably be needed to pass any health plan. But a high administration official said, "I think Long is serious. Sure, he may have to juggle here and there to get a bill, but I think he'll go pretty far."

What Long introduced this year, in one of several plans he has sponsored in recent years, is a bill to establish only a new catastrophic health insurance system, financed by a federal payroll tax offset by some tax credits.

In the last few weeks, however, he started talking in the Finance Committee of ordering employers and employes to pay the main costs, at a total annual bill of $5 billion in private and federal outlays.

This plan, he said, would also include federal spending to help the poor and aged. Long and Sen. Abraham A. Ribicoff (D-Conn.) had long joined in seeking such an effort, though the political wisdom was that it had been shelved for this session.

Kennedy wants to cover everyone in the nation for almost every illness by adding $28.6 billion in federal funds and $11.4 billion in private funds to the nation's annual health spending.

The president Tuesday asked Congress for a $24.3 billion a year plan: $6.1 billion in compulsory employer payments for catastrophic coverage and $18.2 billion in federal outlays for the poor, aged, disabled, mothers, infants and others.

Asked to say how much health insurance he could vote for now, Long said, "A maximum of about $20 billion, including $7 billion to $8 billion in the private area and $12 billion to $13 billion in federal outlays" for the aged, poor and others, with a start" in 1980 or 1981 and reaching the maximum in fiscal 1983.

"So the gap between what I'm suggesting and the president's costs is not all that great," Long said.

On hospital cost controls, Long said he would back the president's plan, though not necessarily every detail of it, "on crucial votes." The Senate Labor and Human Relations Committee, including Kennedy, voted 11 to 4 yesterday for a revised version of the president's bill to put a federal lid on hospital cost increases if hospital fail to restrain them themselves.

Kennedy's view of the Carter health insurance proposal - he called it inflationary for lack of tough enough controls - was labeled absurd yesterday by presidential spokesman Jody Powell.

Kennedy's rhetoric this week on the issue has been more restrained, but no one expects him to quit crusading for total health insurance, no matter what Congress does this year or next.