President Carter, commemorating the first anniversary of the signing of the Egyptian-Israeli peace treaty, said yesterday that domestic political considerations should not be allowed to interfere with efforts to achieve a comprehensive peace in the Middle East.

In a ceremony heavy with political overtones, the president told several hundred guests in the East Room of the White House:

"Domestic politics cannot be allowed to create timidity or to impose obstacles for delay or to subvert the spirit of Camp David or to imply a lack of commitment to reaching our common goal."

Politics, however, could not be divorced from the White House ceremony, which took place two days before the New York presidential primary, in which Jewish voters traditionally account for about one-third of the Democratic electorate. The actual first anniversary of the treaty signing is Wednesday, the day after New York votes.

Carter's comments about domestic politics appeared to be aimed at his major Democratic rival, Sen. Edward M. Kennedy (D-Mass.), and other critics who have charged that the administration jeopardized the Middle East peace talks by a recent blunder at the United Nations.

The controversy centered on a U.N. resolution, which the United States at first supported and then quickly disavowed, that called on Israel to dismantle its settlements in occupied Arab territories.

The U.S. support for the resolution provoked a storm of protests from Israelis and American Jews, which the president sought to soften yesterday by reaffirming American support for Israel.

Carter's speech was interrupted by applause when he declared, "We will not negotiate with the Palestine Liberation Organization nor recognize the PLO" until it accepts Israel's right to exist.

"We oppose creation of an independent Palestinian state and we are committed to a Jerusalem that will forever remain undivided, with free access to all faiths to the holy places," he added.

Despite the warm words that marked the event, and the praise for the two absent principals, Egyptian President Anwar Sadat and Israeli Prime Minister Menachem Begin, the White House ceremony came at a critical time in the Middle East peace negotiations.

Sadat and Begin are scheduled to meet separately with the president next month here in an effort to move the Palestinian autonomy negotiations toward completion by the May 26 target date.

The autonomy talks, the next step in the process begun with the Camp David peace accords and the Egyptian-Israeli treaty, are aimed at creating an interim system of limited self-government for the Palestinian inhabitants of the Israeli-occupied West Bank and Gaza Strip territories.

Progress has been slow in the autonomy talks, which have been complicated by the continuing controversy over the Israeli settlements as well as other factors. Underscoring the difficulties in the negotiations, the White House ceremony came on the day the Isreali Cabinet narrowly voted to support establishment of a Jewish settlement in the West Bank Arab city of Hebron.

The settlements were not mentioned during the White House ceremony, but differences in approach were evident in the remarks of the two ambassadors to the United States, Ashraf A. Ghorbal of Egypt and Ephraim Evron of Israel.

Ghorbal said "a stalemate looms" in the autonomy talks and that Carter, once again, was being asked to break it.

"At this hour of happiness," he said, "we cannot but remember the Palestinian people, who for a very long period have been yearning to reach their national fulfillment."

Evron said the talks, despite difficulties, are "the only avenue by which we can keep the peace process moving ahead.

"Let us reaffirm our resolve not to be deflected by anyone from the path of peace we have chosen."

Like the others, Carter vowed not to allow the autonomy talks to fail. "These negotiations are the road to peace," he said. "They can succeed, they must succeed."