The AFL-CIO, in a legal counter offensive against President Carter's anti-inflation program, filed suit in federal court here yesterday to bar the administration from penalizing violators of the "voluntary" wage guidelines.

The huge labor federation, joined by nine affiliated unions with major contract negotiations this year, charged there is no basis in law for the administration's only official sanction against violators: withholding federal contracts.

"We believe that 'penalties' for 'violators' clearly makes the wage controls mandatory and not voluntary," said AFL-CIO President George Meany at a press conference to announce filing of the suit, which was authorized by the federation's executive council last month.

"Since there is no statutory basis for this action," Meany added, "we have asked the court for an injunction prohibiting the use of such tactics."

If the case, which was assigned to U.S. District Court Judge Barrington Parker, results in a victory for the AFL-CIO, the administration would be free to seek voluntary compliance with its program -- but without any penalties for violators unless they are enacted by Congress. The AFL-CIO had advocated congressional enactment of across-the-board controls on the whole economy.

While the unions are not now seeking a temporary restraining order to block enforcement of the contract sanctions immediately, union attorneys said they may do so if the Justice Department attempts to delay a speedy hearing on merits of the case.

Timing is important because many AFL-CIO unions, along with the independent Teamsters and United Auto Workers, are negotiating new contracts and wage reopeners over the next six months, in many cases with companies that have large government contracts.

The Justice Department has said contract debarment is rooted in legal precedent, but the American Bar Association and two congressional agencies, the General Accounting Office and the Congressional Research Services of the Library of Congress, have questioned the applicability of those precedents to anti-inflation-guidelines.

A key difference, the AFL-CIO has contended, is that Congress said specifically it was not sanctioning wage or price controls when it authorized the Council on Wage and Price Stability in 1974.

The AFL-CIO argues that the administration's proposed 7 percent ceiling for annual wage and benefit increases is a control rather than a voluntary guideline because it is enforced by the debarment penalty, under which contracts of $5 million or more are to be denied companies that exceed either wage or price guidelines.

The price guideline -- generally computed at one-half a percentage point below 1976-77 average increases -- is a "joke," Meany said, leaving the wage standard as the only real curb to inflation.

Unions joining the AFL-CIO in the suit involve electrical, rubber, steel, chemical, oil, telegraph, dock and,achinery-making workers. Companies identified as libale for sanctions if these unions break through the guidelines include DePont, General Electric, Rockwell International, Gulf Oil, Goodyear Rubber and Western Union.

Meany also said the AFL-CIO's previously announced "Price Watch" program of encouraging the federation's 13.5 million members to monitor retail price increases will begin shortly. He said union picketing and consumer boycotts may result, although the AFL-CIO was not encouraging such action at this point.