Even as Congess was killing a proposed 17 percent pay raise for fear of public reaction, a presidentially appointed commission recommended yesterday that congresional pay be increased 40 percent and that comparable increases be given to nearly 3,000 federal judges, Cabinet members and other officials at the top of the government.

The nine-member advisory Commission on Executive. Legislative and Judicial Salaries -- one is appointed every four years -- said that pay levels in the upper reaches of the government have been allowed to lag far behind inflation. Unless they are brought back in line, chairman Jospeh H. McConnell said, the flight of able people from the judiciary and civil service could become a severe problem.

Among the commission's recommendations:

Senators and representation would go from their current $60,662 to $85,000. The House speaker and the vice president would jump from $79,125 to $120,000. The Senate president pro tem and the House and Senate majority and minority leaders would go from $68,575 to $95,000.

Cabinet members, who make $69,630, would rise to $95,662 to $85,000, deputy secretaries of minor departments from $55,387 to $80,000, assistant secretaries and general counsels $52,750 to $75,000, and upper-echelon administrators from $50,112 to $70,000.

In the judicial branch, the chief justice of the Supreme Court would go from $84,700 (the level set by a Supreme Court decision on Monday) to $120,000. Associate justices of the Supreme Court would get $115,000. Appeals court judges would go to $90,000, and federal disrict judges to $85,000. District judges until Monday were getting $54,500 but would be raised under the Monday decision to $61,600.

The recommendations of the commission go to the White House, where, by law, the president must next recommend to Congress in his budget message whether to adopt or change them. Each chamber is then expected to vote within 60 days on his recommendation. Approval of both the House and Senate is needed for changes to take effect.

A spokesman for the outgoing Carter administration said the Office of Management and Budget is analyzing the proposals and will present a range of options to the president.

Tom Korologos, interim director congressional liaison for President-elect Ronald Reagan, said, "The president-elect might favor some increases but has made no decisions on specifics."

The Reagan team did support the proposed 17 percent pay raise killed by the Senate, on grounds that low pay rates were making it hard to recruit good people for the new administration.

McConnell said that since 1969, the cost of living has gone up 135 percent but congressional salaries have risen only 43 percent, salaries of undersecretaries of Cabinet departments the same, and salaries of appeals judges only 35 percent. Measured in 1969 dollars, a member of Congress is making only $25,800, he said. The recommended increases would not quite make up for the intervening inflation, but would come close. The commission recommendations are based in part on studies of how much similar jobs in state and local government and in private industry have gone up.

In view of what has happened in the last week, congressional approval for the full range of increases proposed by the commission seems questionable. When the 17 percent increase was tacked onto another bill, the Senate rejected it and refused to allow Congress to go home until it was killed.

In addition to raising directly the salaries of nearly 3,000 members of Congress, judges and high-level executives, the commission recommendations, if put into effect, would allow salary increases for 33,539 lower-level officials whose pay levels have been frozen by Congress to keep them from exceeding the pay of higher-ups. Most of these 33,539 are at GS levels 14 and 15 or in the Senior Executive Service. Most are frozen at $50,112.

The commission estimted that pay for top executives, members of Congress and judges and for affected GS 14s, 15s and SES employes would go up from the current $1.8 billion to about $2.1 billion if commission recommendations were adopted.

In addition to the salary recommendations, the commission proposed that congressmen be given a $10,000 annual expense allowance to cover extra costs of holding office, especially those arising from dual residences, and that members of Congress and high-level officials receive reimbursement for moving expenses when they enter federal employment.