Israeli Defense Minister Ariel Sharon met for more than four hours here today with Egyptian President Hosni Mubarak and Foreign Minister Kamal Hassan Ali in an attempt to settle a dispute threatening to hold up Israel's final withdrawal from the Sinai April 25.

The two sides also discussed Israeli allegations of Egyptian violations of the peace treaty signed between the two nations in 1979.

Following Sharon's 80-minute meeting with Mubarak, Ali said they had discussed "frankly" all the issues raised by Israel during the past few days and that the Egyptian side had responded point by point.

On the touchy issue of the border demarcation at Taba, on the Gulf of Aqaba, Ali said there was still more to be discussed but that the main principles of an agreement had been reached already.

He described these as including Israel's withdrawal to the 1906 international border as defined by Egypt, the Egyptian advancement up to the same line as designated by Israel and recourse to Article 7 of the treaty calling for arbitration or reconcilation to settle the issue later.

In effect, the quarter-square-mile of land in dispute, where Israel is building a tourist complex, would be demilitarized and temporarily policed by the 2,500-member multinational peace-keeping force organized to report on violations by either side.

Asked whether the final Israeli pullout from the Sinai was in question because of the issue, Ali replied, "The withdrawal, I think, will be on the 25th as scheduled and as stated by Prime Minister Menachem Begin yesterday and by President Reagan as well."

Sharon, who earlier declared his opposition to the final withdrawal unless the border issue were resolved, gave no indication whether he agreed with Ali's assessment.

He said only that the two sides has discussed "all the problems" and that he would report on his discussions here to Begin later today.

In Tel Aviv, meanwhile, U.S. Deputy Secretary of State Walter Stoessel said he was "optimistic" that the Israeli withdrawal would take place on schedule after holding two hours of "very friendly, very thorough" talks with Begin.

Stoessel reportedly was given a list of the Israeli allegations of Egyptian violations of the peace treaty and a list of alternative solutions to take to Cairo Friday.

The three main Israeli charges are that Egypt has not adhered strictly to the peace treaty's limitations on troop levels in the central Sinai zone, has allowed Palestinians to smuggle arms into the Gaza Strip and has permitted a hostile tone toward Israel in the state-controlled press.

Egyptian officials have denied the charges and pledged full commitment to the peace treaty. Privately, they have expressed concern that Israel may be seeking a pretext for not carrying out its withdrawal.