Sen. Edmund S. Muskie (D-Maine) yesterday sharply criticized states for seeking a constitutional amendment to require a balanced federal budget, and warned that federal aid to states would be the first program Congress would cut if such a measure were passed.

In a speech before the National Press Club, the Senate Budget Committee chairman noted that the states collectively ran $29 billion in surpluses during 1978 -- a figure he said matches the $29 billion federal budget deficit President Carter proposed last month.

Muskie pointed out that the budget for fiscal 1980 calls for $82.9 billion in federal grants to states and localities, a total he suggested would be cut sharply if the budget had to be balanced. "An appealing solution to the balance dilemma," he said, "comes very quickly to mind."

Muskie issued his warning in an unusually stern address in which he lambasted the balanced-budget proposal as "an ill-considered contrivance," and branded the idea for a full-blown constitutional amendment "the wrong way out of a troublesome dilemma."

He said the "most alarming prospect of all" would be the prospect of calling a constitutional convention to consider the proposal. Muskie warned that the move could open the way for similar constitutional moves for or against abortion, gun control or other issues.

The budget chairman's comments marked the beginning of what is expected to be a concerted effort by congressional moderates and liberals to head off the drive for a new balanced-budget amendment, now gaining momentum across the nation.

In large part because of a push by state legislatures, more than two dozen states already have endorsed the notion of a balanced-budget amendment, and sponsors say they may obtain the required 34 states' approval before the year is out.

A poll published yesterday by the Associated Press and the National Broadcasting Co. showed that 70 percent of 1,600 Americans interviewed favored a balanced-budget amendment, with the support spread among virtually all major income and demographic groups.

Muskie conceded that the poll reflected "a mood by the American people to rebel against inflation," but said that, too often, state legislators simply reacted to that sentiment without thinking fully about the consequences for the economy.

Muskie charged that. in many statehouses, houses, "prudence has given way to panic." He said "resolutions to change the Constitution of the United States are introduced at noon and adopted before dinner -- sometimes without a single hearing" or "as much debate as a new state song would engender."

In one such case, in Pennsylvania, Muskie noted that legislators pushed through a resolution supporting a balanced-budget amendment only minutes after they approved a similar measure calling for a renewal of federal revenue-sharing grants for states and localities.

Besides raising the specter of a runaway constitutional convention, Muskie also criticized the balanced-budget amendment as unworkable in times of deep recession. He said that even where proposals contained an escape clause, it would be difficult for Congress to run a deficit.

Muskie's warning to the states was blunt and to the point. "Twenty-five of them are leading us into a serious mistake," he said, "and they will pay the biggest price. If Congress must suddenly chop the deficit, it will land in the laps of the states."

(Idaho yesterday became the 26th state to call for a constitutional amendment requiring a balanced federal budget.)

Muskie told the session that was "not a threat -- it's a matter of arithmetic. We could save $31 billion -- $2 billion more than the president's projected deficit -- merely by killing revenue-sharing, education grants, sewerage construction,... block grants and the [jobs] program."

Muskie's warning was important because, as chairman of the budget panel, he would play a key role in those cuts. Although the amendment would be handled by the House and Senate Judiciary committees, the budget panels would decide on spending levels.

Muskie's comments came as, separately, Alice M. Rivlin, director of the nonpartisan Congressional Budget Office, told Congress that meeting the goals of last year's Humphrey-Hawkins so-called full employment act "looks harder now than it did a year ago" because inflation has accelerated.

The measure, which Congress enacted under pressure from black groups and liberals, calls for reducing the nation's unemployment rate to 4 percent by 1983 while trimming the inflation rate to 3 percent. Inflation now is running at a 9 percent Pace.