Prime Minister Menachem Begin told the Israeli people tonight that his Cabinet will vote tomorrow on the final draft of a peace treaty to end 30 years of a state of war between Egypt and Israel. If Israel's parliament does not then approve the accord, Begin said, he will resign.

Less than two hours after President Carter's dramatic announcement in Cairo that Egyptian President Anwar Sadat had agreed to the latest compromise treaty proposals, Begin said the accord could be signed as early as the end of next week.

Headcounters tonight already began predicting a decisive approval of the new treaty language once the Knesset, Israel's parliament, holds what is expected to be a long and stormy debate.

Begin cautioned that not every detail of the Egyptian-Israeli accord had been approved by the Cabinet, but he said the "greater issues are now agreed upon" by Israel and Egypt and that a treaty is near.

Begin also said he had discussed with Carter a U.S.-Israeli defense pact with U.S. guarantees of Israeli security but said that it was up to Carter to formally propose such a pact. Begin said he is interested in such a defense arrangement.

"If the Cabinet takes the decision that will make it possible for me to say that all the issues are resolved, then we shall go to the parliament for approval at the beginning of next week," Begin said.

He added, "If there is a majority in the parliament, then we shall sign."

Begin's surprise announcement was coupled with a warning that if the Knesset fails to ratify the pact, his government would resign.

"There will be a debate, no doubt. Also, there will be opposition -- no doubt about it.... Of course, if the government suggests to parliament to approve a draft peace treaty, and there is no majority, then it will be the democratic duty of the government to resign," Begin said.

He was referring to the parliamentary tradition of collective responsibility for government decisions, wherein the 18-member Cabinet -- which in effect is a representative form of the parliament in miniature -- would lose confidence of the larger body if it were overruled on such a fateful decision.

Resignation of Begin's government would be followed by new parliamentary elections, in which the Israeli electorate could make its position on the issue known.

Begin referred to the prospect of parliamentary rancor, saying, "The debate may be quite a long one -- a day and a night, or two days." The original Camp David "framework for peace" agreements were debated bitterly in the Knesset for 17 uninterrupted hours, but in the end were approved by a 4 to 1 margin.

Judging from the initial reaction tonight of key political leaders, the final draft treaty will also pass in the Knesset.

Shimon Peres, leader of the opposition Labor alignment, signaled as much when he complimented Begin for reaching an agreement and indicated his party members would approve it.

After reiterating his party's position of supporting peace with Egypt -- but expressing reservations that Palestinian self-rule in the West Bank and Gaza Strip will lead inevitably to a Palestinian state -- Peres said, "We will look forward to an early opportunity to express these two positions of our party."

But, asked if his party would use the opportunity to bring about the collapse of Begin's Likud coalition, Peres replied, "Frankly, in my judgment, peace comes before power and I would prefer to see a peace with mistakes than the removal of a government that I do not consider the right government."

Deputy Prime Minister Yigal Yadin, leader of the Democratic Movement, said he "can anticipate a decision tomorrow (in the Cabinet) that will not be unanimous," but he indicated confidence that there would be approval by both the Cabinet and the Knesset.

In the meantime, Yadin said, "It is best for everyone to understate his views and wait for developments."

Begin, in a 15-minute radio address tonight, said he will not make a recommendation to the Cabinet either way when the issue comes to a vote.

He said Carter asked him to take a position on the issue, but he in turn asked the president to "relieve me of that responsibility," because it would appear to his opponents to be a form of pressure.

The most outspoken critics of Begin's peace policy have been rightwing members of his own Herut Party, who accuse him of selling out Israeli control over the Sinai and West Bank under U.S. pressure.

Begin also said he will not attempt to pressure Knesset members, but will allow them to "vote on the basis of their own consciences." He made a similar pledge when the Knesset voted on the original Camp David agreements in September, but then, at the last moment, issued an impassioned plea on behalf of the peace plan.

As late as Monday night several issues reportedly had defied compromise and officials accompanying Carter were decidely downcast.

A breakthrough on the question of an exchange of ambassadors reportedly came today at a breakfast meeting between Begin and Carter, when Begin offered to give Egypt a precise timetable for Israeli withdrawal from the Sinai Peninsula in exchange for ful diplomatic relations.

Last November, Egypt asked for a detailed monthly timetable for full withdrawal, accompanied by maps showing interim monthly withdrawal phases, but Israel refused, saying the proposal was outside the spirit of the Camp David agreement.

Now, Israel apparently has agreed to the stepped-up timetable, and Egypt reportedly has agreed to an exchange of diplomatic representation at full ambassadorial level.

Under the previous treaty draft, Israel was to have specified only that it would withdraw within nine months from half the Sinai.

The new agreement, which will be presented to the Cabinet along with the U.S. commitment to guarantee oil sales to Israel for 15 years in the event Egypt does not agree to sell 17.5 million barrels of oil to Israel each year, was worked out by Carter at today's breakfast and presented to Sadat for approval. The Ford administration had previously been committed to the United States maintaining Israeli's oil supplies.

The two sides have also reportedly agreed on a limited Egyptian civilian presence in the Gaza Strip during the transition to autonomy. Egypt which had administered the territory before Israel captured it in 1967, had sought what Israel viewed as an extensive presence in the Gaza Strip.

Carter's visit here ended as it began, with pomp and ceremony at Tel Aviv's Ben Gurion airport and with vaguely optimistic speeches about where the 15-month, on-and-off peace negotiations were headed. There was hardly any hint of a dramatic breakthrough.

Standing in front of Air Force One under dark winter skies and looking visibly tired from his grueling six-day shuttle, Carter appeared to be putting as good a face as possible on what was thought to be an uncompleted peace mission, saying he was confident that, despite difficulties, a treaty eventually would be signed.

The breakfast meeting he had with Begin, Carter said, focused on the remaining "two or three most difficult issues." He added, "Prime Minister Begin and I were able to make substantial additional progress."

Carter gave no hint of the frustration his aides said had accompanied his role as mediator in the negotiations. He said, "President Sadat, Prime Minister Begin and I remain determined to exert every ounce of effort at our command to bring the peace effort to a successful conclusion -- and we will not fail."

As if to underpin Carter's portrayal of the shuttle as one of achievement, Begin turned to the president and said, "You came here on the highest mission of humanity -- for peace -- and you have succeeded. We made real progress. Now, of course, it is the turn of Egypt to give its reply."

There was an Alice-in-Wonderland quality Monday night in the contrast between statements issued by White House press secretary Jody Powell and by some Israeli leaders, including Begin.

Briefing American reporters, Powell was clearly gloomy in his assessment of the prospects.

Begin, however, said an hour earlier that "great progress" had been made, and some of his aides suggested that the Americans were trying to put some psychological pressure on Israel to reconsider earlier positions before Carter's final meeting with Begin.

Begin tonight alluded to Powell's seemingly misleading statements to the American reporters.

Asked why there was a sudden change in what had been reported as a possible failure, Begin said, "The American commentators should beat their breasts. Maybe not the commentators but those who gave them the briefings. They should apologize."