The leaders of Israel and Egypt finally concluded a treaty of peace yesterday as President Carter pledged to join them in protecting the agreement against those who oppose it.

At a windswept ceremony on the north lawn of the While House, Egyptian President Anwar Sadat and Israeli Prime Minister Menachem Begin signed the treaty text and accompanying documents that officially ended 30 years of bitterness and war between Israel and its largest Arab neighbor.

"Let those who would shatter peace -- who would callously spill blood -- be aware that we three and all others who may join us will vigorously wage peace," Carter declared to 1,600 invited guests on the White House lawn and a worldwide television audience of millions.

Throughout the 45-minute ceremony, the shouts of Arab protesters who were confined to Lafayette Park drifted across Pennsylvania Avenue toward the White House, a reminder of the uncertainties that lie ahead in the Middle East following the historic treaty signing.

Coming after 16 months of high drama and intense negotiations that teetered on the brink of failure several times, the formal signing of the treaty seemed strangely subdued when weighed against the passions and hatreds that the ceremony was supposed to still.

The three leaders read from prepared statements while seated behind an eight-foot-long 19th-century walnut table positioned on the lawn, and did not engage in any of the euphoric, spontaneous exchanges that marked their joint appearance in September to announce that the Camp David summit had produced framework agreements for peace.

Their speeches promised to banish war forever between Egypt, the Arab world's largest and most militarily powerful nation, and Israel. "Let there be no more wars and bloodshed between Arabs and Israelis," Sadat said in the most heavily applauded passage of the day. "Let there be no more suffering or denial of rights."

The last phrase apparently alluded to the plight of Palestinian refugees driven from their homes in the 1948 and 1967 wars. The Palestinian cause has been a driving force in Arb politics throughout the Arab-Israeli conflict, but the agreements signed yesterday hold out only a vague promise of increased rights for the Palestinians.

Sadat's prepared text contained a generalized appeal for support for "the Palestinian people." But the Egyptian leader evidently decided at the last moment not to interject the controversy over the Palestinian-inhabited West Bank and Gaza Strip territories into the signing ceremony. He skipped over that section when reading the speech.

Last night, however, at a ceremonial White House dinner given by Carter, Sadat once again surprised his negotiating partners by devoting his toast to "the plights of the Palestinian people." He called the agreement "a first step on the road to self-determination and to statehood" for the Palestinians, goals that Begin has repeatedly said Israel will block.

Sadat also underscored what he sees as the new and deep American involvement in the region by saying during the toast that Carter has promised to work actively "as a full partner" for a solution on the West Bank and Gaza. He echoed a proposal made by Begin at the dinner to nominate Carter for this year's Nobel Peace Prize, an award the Egyptian ad Israeli leaders shared in 1978.

Begin avoided referring to the West Bank negotiations in his remarks at the treaty signing and the dinner. He did job deftly, however, at Egyptian claims that the treaty will lead to a return of East Jerusalem to Arab control. By listing the t reaty signing as "the third greatest day of my life" (after the independence of Israel in 1948 and the taking of East Ferusalem by Israeli troops in 1967), Begin appeared to be saying that Jerusalem is more important to him than is the treaty.

The articles of the treaty signed yesterday and its accompanying set of agree interpretations and three annexes establish detailed schedules for a return of the Sinai peninsula to Egyptian sovereignty over the next three years.

Israeli troops will pull back to a line drawn between the northern coastal town of El Arish and the southernmost point of the Sinai, Ras Mohammed, within nine months of the t reaty signing. One month after that, Egypt and Israel will exchange ambassadors and begin the normal economic and diplomatic relations that Israel has gought with its Arab neighbors since 1948.

To get the Sinai back, Sadat finally softened his demands for a binding target date for elections of strong, self-governing, administrative councils for the West Bank and Gaza. A letter signed by Sadat and Begin and given to Carter as part of the package yesterday calls for negotiations to begin within a month of the treaty signing on ways to hold elections and set up the councils, whose powers and responsibilities are not defined.

The vegueness of the commitment on the Palestinians and the failure of the agreement to mention Syria's Golan Heights, also captured by Israel in 1967, have triggered intense criticism of Sadat in the Arb world. He has failed to win the support of Jordan's King Hussein, whose help Sadat would presumably need in negotiating on the West Bank, and of Saudi Arabia's royal family.

Just as Carter served as a bridge between the two old enemies throughout the negotiations, he was seated symbolically between them during yesterday's ceremonies. And just as it was Carter who pushed those negotiations through several near-fatal impasses, it was he yesterday who placed the greatest stress on the dangers of the future.

Calling the treaty only "a first step on a long and difficult road" the president appealed for patience, understanding and a rededication of effort by those who seek "a broader peace with justice" thoughout the Middle East.

"We have no illusions -- we have hopes, dreams, prayers, yes -- but no illusions."

Referring to other Arab leaders who oppose the treaty and have accused Sadat of betraying the cause of the Palestinians, Carter said:

"There now remains the rest of the Arab world whose support and cooperation in the peace process is needed and honestly sought. I am convinced that other Arab people need and want peace, but some leaders are not yet willing to honor these needs and desires. We must now demonstrate the advantages of peace, and expand its benefits to encompass all those who have suffered in the Middle East."

Like Sadat and Begin, who followed him in speaking, Carter quoted from the prophet Isaiah -- "nations shall beat their swords into plowshares and their spears into prunighooks," He also quoted from the Moslem Koran, and concluded:

"Let us now lay aside war. Let us now reward all the children of Abraham who hunger for a comprehensive peace in the Middle East. Let us now enjoy the adventure of becoming fully human, fully neighbors, even brothers and sisters. We pray God together that thest dreams will come true. I believe they will."

The t reaty signing, on a sunny but cold spring afternoon, was the ceremonial highpoint of Carter's presidency. And although the formal ceremony lacked the drama and emotion that accompanied the announcement of the Camp David accords, the president clearly enjoyed it.

Carter smiled broadly as the documents were signed. Behind the three men, the flags of their nations fluttered wildly in the stiff breeze that swept across the lawn.

After signing the treaty as a witness, the president turned to Begin and siad, "Let's have a handshake." With that, the three men rose as the crowd applauded for a round of handshakes, ending with the three of them joining hands, one on top of the other.

Through much of the ceremony, Sadat appeared unusually stiff, almost grim. Begin clearly enjoyed himself, but a times appeared distracted, gazing out over the crowd that included members of Congress, Cabinet officials, White House aides and Jewish leaders from around the country.

Yesterday morning, the president met privately with the two leaders, receiving Sadat first and, an hour later, Begin, in the Oval Office. Carter gave both a collection of photographs from the recent Voyager spacecraft mission to Jupiter.

White House officials disclosed no other details about the private meetings.

Following the meeting with Begin, the president and Rosalynn Carter were hosts at a lunch in the White House for Sadat, Begin and their wives.

As the lunch was going on, Metropolitan Police closed off Pennsylvania Avenue to traffic, and spectators beg an gathering at the edge of Lafayette Park directly across the street from the site of the treaty singning.

The invited guests sat on folding chairs on the lawn or stood while, ringed around them, hundreds of reporters and photographers from news organizations from around the world recorded the scene.

The ceremonies began just after 2 p.m. as Carter, flanked by the two men with whom he spent so many hours during the marathon negotiating sessions, strode out the front door of the White House and down the steps to a raised platform on the lawn where the documents were signed.

The three men were dressed almost identically in dark business suits, white shirts and subdued ties.

After his speech, the president sat back in his chair, turning first toward Sadat to listen to his remarks and then to Begin.

Much more than Begin, Sadat was effusive in his praise for Carter, whom he called "the man who performed the miracle."

"Before anything else," the Egyptian president said, "the signing of the peace treaty and the exchanged letter is a tribute to the spirit and ability of Jimmy Carter."

Begin provoked the only laughter that marked what was a curiously somber ceremony despite the accompanying musci of the Marine Corps band, which at times drowned out the shouts of the Arab protesters. In a reference to his reputation as a legal nitpicker during the negotiations, the Israeli prime minister said to Carter:

"Our friend, President Sadat, said that you are the unknown soldier of the peace-making effort. I agree, but as usual, with an amendment. A soldier in the service of peace you are. You are, Mr. President, even mirable dictu, and intransigent fighter for peace.

"But Jimmy Carter, the president of the United States, is not completely unknown. And so it is his efforts which will be remembered and recorded by generations to come."

Last night, an ecumenical service of Christian, Jewish and Moslem prayers was held at the Lincoln Memorial to commemorate the treaty signing. The three leaders who negotiated the agreement did not attend, apparently for security reasons.