President Anwar Sadat yesterday formally invited President Carter to come here for the signing of a peace treaty between Egypt and Israel.

He told applauding members of parliament that "all people in this country will be looking forward to show their feelings toward this great man," who he said had saved the Camp David summit meeting by dissuading Sadat from walking out.

Sadat later told reporters that Carter had accepted the invitation. Cairo Radio announced that negotiations over the terms of the treaty would begin in Washington Oct. 12, and the document is expected to be signed before Christmas.

The White House confirmed that invitations had been sent to both Egypt and Israel for the Washington talks.

Sadat announced his invitation to Carter at the beginning of a three-hour speech to the People's Assembly, or parliament, in which he strongly defended the Camp David agreements, criticized the Arabs who oppose them as tools of the Soviet Union, appealed to King Hussein of Jordan to "shoulder his responsibilities," and said he would name a new government to manage Egypt's transition from war to peace.

The task of the new government, Sadat said, will be to produce a timetable for the development of the Sinai - to be returned to Egypt by Israel - and for an improvement in public services, which have been badly negliected during three decades of a state of war.

The official Middle East News Agency later announced that Mustapha Khalil, a veteran politician, had been appointed prime minister.

He succeeds Mamdoun Salem, a career police official who helped Sadat consolidate his hold on the presidency after the death of Gamal Abdel Nasser in 1970 and was rewarded with the prime ministership in 1975.

"Now that we are on the threshhold of peace," Sadat told the parliament, "the people are calling on me to dedicate myself to the internal situation . . . We must work harder, we must dedicate oursleves. We are embarking on a big change." He acknowledged that "it cannot happen overnight," but assured the delegates that "we are on the way to peace and on the way to prosperity."

His appearance before parliament