What Congress heard yesterday from President Carter was the opening shot in what promises to be the biggest budget battle since President Nixon tried to dismantle the Great Society a decade ago.

It will test political wills in an election year against the demonstrated potency of many of the nation's most powerful interest groups and try the congressional budget control process as it has never been tried before.

With the Soviet invasion of Afghanistan just behind them and rumbles of a recession just ahead, lawmakers will be torn between guns and butter as they attempt to meet Carter's challenge to balance next year's budget by cutting $13 billion in proposed federal spending.

To do this and to go along with Carter's proposed credit limits and his oil import fee that will raise gasoline prices by 10 cents a gallon, they must offend some of the most powerful interests in American society: bankers, the oil industry, labor unions, mayors and governors, the hospital lobby, among others.

The idea of a balanced budget drew heavy support from Democrats as well as Republicans, from many liberals as well as conservatives. Senate Budget Chairman Edmund S. Muskie (D-Maine) went so far as to "guarantee" that his committee would approve a deficit-free budget resolution for 1981.

But there were distress signals, too.

House Budget Committee Chairman Robert Giaimo (D-Conn.) who plans to offer a balanced budget resolution to his committee next week, said he thinks Congress will approve cuts necessary to balance the budget now, but asked. "Will they make the necessary appropriations cuts next summer to toe the line?"

Moreover, defense-minded legislators like Sen. Sam Nunn (D-Ga.) served notice they will fight for increased defense spending at the expense of other programs, just as advocates of social welfare spending were calling for sacrifice by the Pentagon, too.

It was from outside of Congress, however, the the drums were beating the loudest -- in many cases from interest groups that successfully fended off the budget ax in the past.

The National Governors Association and National Conference of State Legislatures took aim at the president's proposal to cut $1.7 billion in revenue-sharing money for states, and the U.S. Conference of Mayors complained that the cut would shift the burden for some major social programs to local governments.

Hospital groups that engineered the defeat of hospital cost containment legislation last year said they would go all-out, if necessary, to beat Carter's attempt to revive it (and thereby hold down Medicare and Medicaid costs).

The American Petroleum Institute, representing the oil industry, said Carter's "complex system of import fees, to be paid by consumers through higher gasoline prices, will perpetuate and increase the federal energy bureaucracy that the president has described as 'so complicated it's almost unbelievable'."

The Highway Users Association also decried the prospect of a 10-cent-a-gallon increase in gasoline prices.

The bankers lobby didn't say anything about Carter's proposal for withholding taxes on dividends and savings account interest, but Congress has not forgotten its scuttling of such a proposal four years ago.

AFL-CIO President Lane Kirkland vowed to fight cuts in domestic programs that labor unions support and hinted that labor's participation in its "national accord" with the administration on economic policy may be in jeopardy.Kirkland noted that the AFL-CIO supported Carter's January budget proposal and added: "We are deeply distressed that it has now been so quickly and crudely scuttled in sacrifice to expediency, congressional electionly and crudely scuttled in sacrifice to expediency, congressional election-year posturing and the demands of the financial community."

Jerry Wurf, president of the 1 million-member American Federation of State County and municipal employe, said the program would "wreak havec on urban America . . . while doing nothing about inflation" and called it a "return to the economic philosophy of Herbert Hoover." The American Federation of Government Employes attacked the federal employe pay changes and the hiring restrictions if this means more work will be contracted out.

The National Association of Manufacturers endorsed the budget balancing effort but called for faster movement toward productivity gains. The liberal Americans for Democratic Action said Carter's proposals are the "same old tired (ones) that have failed in the past -- cuts in human needs programs, high interest rates and even higher gasoline prices."

There was heavy flak from the campaign trail, too.

Sen. Edward M. Kennedy (D-Mass.), Carter's principal rival for the Democratic nomination, called the program "too little, too late" and said the import fees would add to inflation while the budget cuts would strike hard at "those in greatest need in our society."

Damning with faint praise, Sen. Bob Packwood (R-Ore.) said, 'It seems the president has learned more about inflation in the last 10 days than he has in his first three years in office."

Former California Governor Ronald Reagan, the front-runner for the Republican presidential nomination, said he was "delighted to see [Carter] whipping away" at his own budget but accused the president of trying to balance the budget by raising taxes.

This was a favorite theme of congressional Republicans, too. Sen. William V. Roth (R-Del.) called it the "Abscam of economics [that] appears to be one thing but it's quite another" -- a tax increase posing as a balanced budget. Sen. John G. Tower (R-Tex.) called it a matter of "fraud, duplicity and insufficiency."

Among Democrats, Rep. Thomas Foley (D-Wash.), chairman of the House Democratic Caucus, said a balanced budget "by itself won't affect inflation very much, but the people need a demonstration that the federal govenment can live within its means. Rep. David Obey (D-Wis.), chairman of the Democratic Study Group, said it was a "necessary psychological action that has to be taken" but "it's going to be one helluva educational process for the country."

Two black legislators, Reps. Parren Mitchell (D-Md.) and Louis Stokes (D-Ohio) criticized the budget cuts. "It's going to be bloody year" said Mitchell hell. "It's a fraud to go to the public saying it (a balanced budget) will help in the fight against inflation . . . It will hurt the poor the minorities most."

House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) has no enthusiasm for budget cutting and went to Florida to campaign for Democratic House candidates, although he has been described as willing to go along with the cuts. House Majority Leader Jim Wright (D-Tex.) said the plan had his "wholehearted support."

In the Senate, Appropriations Committee Chairman Warren G. Magnuson (D-Wash.) agreed that the budget should be balanced but opposed the gasoline fee on grounds that "it will only add to inflation and encourage OPEC (Organization of Petroleum Exporting Countries) to raise oil prices." Sen. Jacob K. Javits (R-N.Y.) made a similar argument but questioned whether the budget cuts would be enough to erase a deficit that, he said, is probably as much as $30 billion to 40 billion.

Senate Majority Whip Alan Cranston (D-Calif.) endorsed the president's program but said it was a "good guess" that defense spending would be increased beyond what Carter proposed.

Sen. Henry M. Jackson (D-Wash.) called it a "good beginning" that Carter should improve upon by declaring a "national economic emergency." Sen. Donald W. Riegle (D-Mich.) also called for a declaration of emergency that he said should start with the dismissal of presidential anti-inflation adviser Alfred E. Kahn, whom he described as symbolizing the administration's "complete lack of seriousness" about fighting inflation.

On the oil import fee, Rep. John Dingell (D-Mich.), chairman of the main House energy subcommittee, said the fee "isn't going to be very popular" but he would support it. House Banking Committee Chairman Henry S. Reuss (D-Wis.) also criticized the tax saying it would add 1 percentage point to inflation.