President Carter has criticized lawmakers in Ohio and Illinois for voting themselves pay increases that vastly exceed the administration's anti-inflation guidelines, saying elected officials "ought to set an example."

Meanwhile, a West Coast union filed suit in federal court challenging the government's authority to enforce its wage-price guidelines by requiring federal contractors to abide by them.

The Association of Western Pulp and Paper Workers, which filed the suit Friday, said it is the first legal test of the administration's program. A hearing on the union's request for a preliminary injunction was scheduled for Dec. 15 in U.S. District Court in Portland, Ore.

The suit charges that the Council on Wage and Price Stability (CWPS) has exceeded its authority in attempting to hold down wage bargaining, and says that "to call the sanction of loss of government contracts for failure to comply with wage ceilings a 'voluntary' program is a fiction that could fool only a lawyer."

About 15,000 members of the union are on strike against 31 plants of 11 companies, seeking wage increases comparable with those previously negotiated at other plants in the region. CWPS has held that these negotiations are not exempt from the guidelines as "tandem" or pattern contracts. The union disagrees.

Carter's criticism of the Ohio and Illinois lawmakers came in an interview Friday with out-of-town editors and broadcasters. The text of the interview was released yesterday by the White House.

"Obviously, the increase in legislative salaries in Ohio, Illinois or anywhere else by 25 or 30 percent, when we were really trying to hold down wage increases to a 7 percent level, works counter to the best interest of our nation in controlling inflation," the president said.

Carter was referring to pay raises of 29 percent for Ohio state legislators, 40 percent for Illinois state lawmakers, 60 percent for Chicago aldermen and 30 percent for Cook County board members.

A Hite House aide said Carter understated his feelings in the interview. "These pay raises have truly irritated the president," the aide said.

Mark Sheehan, spokesman for the Council on Wage and Price Stability, said the council is investigating the pay increases, but added that he didn't know what more the government could do than criticize them publicly.

Carter said he realizes that he has no legal authority over state legislatures, but added: "... I would hope that legislators around the country would join in wth us in exercising restraint during these times when inflation ought to be in the forefront and when elected officials ought to set an example."

In another development yesterday, Energy Action, a consumer advocacy group, called on the administration to end confusion over whether the anti-inflation program covers energy industries.

Energy Action director James F. Flug said the voluntary wage and price program should have explicitly included fuel along with food, housing and health costs as necessities that require price curbs.

Although the original report neither exempted nor included energy specifically, subsequent legal documents mentioned it, but left unclear whether the industries are covered, he said.

The administration "cannot in good faith ask the public to take the anti-inflation program seriously... if built into the program is a glaring and giant loophole allowing fuel prices to go unchecked," Flug said.

A spokesman for the wage-price council, to whom Energy Action's criticism was addressed, said crude oil and natural gas are included in the guidelines, as are all raw materials, and firms producing them must come under the recommended profit margins test. However, the processed products from these materials are not included, the spokesman said.