Egyptian President Anwar Sadat yesterday attacked Israel's policy of establishing Jewish settlements in occupied Arab territories as "unfounded, ill-conceived and illegal," and said it could seriously jeopardize efforts to achieve a comprehensive Middle East peace.

Sadat, who concluded two days of talks with President Carter on Wednesday, charged that Israel, in effect, is dragging its feet in the stalled negotiations on creating a self-government system for the Palestinian inhabitants of the Israeli-occupied West Bank and Gaza Strip.

In a speech to the National Press Club prior to his departure for home last night, Sadat said he and Carter have agreed on "certain specific steps" for making progress in the autonomy talks, which have a May 26 target date for completion.

He declined to specify what these steps are, since Carter still must discuss them with Israeli Prime Minister Menachem Begin when they meet here next week.

However, it is known that Carter and Sadat are hopeful of winning Begin's agreement to an intensified new round of the U.S.-mediated autonomy talks here later this month.

Then, if those negotiations achieve a break in the impasse, there is a strong possibility that Sadat, Begin and Carter will hold a summit meeting in late May to wrap up the final details of an authonomy agreement.

In the meantime, Sadat used his speech yesterday as an opportunity to argue the merits of the Egyptian position in the negotiations. He focused especially on Israel's West Bank settlements, which are viewed with intense suspicion throughout the Arab world as a pretext for "creeping annexation" by Israel of the occupied territories.

The Israeli policy, he asserted, "generates hatred and friction. It is the worst formula for coexistence. In fact, it is an invitation to further violence and unrest."

Referring to the Israeli argument that Jews should have the right to live anywhere, Sadat said: "Certainly, all peoples must be treated equally and without any discrimination. However, no people has any right to live in other people's territory without their consent and free acceptance."

"Reconciliation cannot be obtained through the expropriation of land and the implanting of hostile entities in the heart of other peoples' land," he said.

Sadat contended that Egypt had carried out all its obligations under last year's Egyptian-Israeli peace treaty in a spirit "never stopped by trivialities and minor matters." But, he added, "this spirit remains to be reciprocated."

He said there is "an urgent need" for Israel to "create an atmosphere of trust and confidence" with the Palestinians by doing far more than it has so far "in freeing political prisoners, lifting restrictions on political activities and reuniting families."

Saving "the Palestinian question is the core of the Middle East conflict," Sadat stressed that the autonomy agreement now under negotiation is only a "transitional arrangement," and he warned that, in any final settlement, the Palestinians must have the right of self-determination.

That seemed to imply continued Egyptian backing for the eventual creation of an independent Palestinian state -- an idea that is vehemently opposed by Israel and that has led the Israelis, in the autonomy talks, to try to limit severely the self-governing rights of the occupied territories.

Implicit in Sadat's remarks was the idea that, if any progress is to be made in the autonomy negotiations, the next move is up to Israel. On Wednesday, though, the Israeli cabinet gave Begin a mandate to discuss only those questions specifically covered in the Camp David accords, and the prime minister might use that to fend off Carter's efforts to talk about the settlements issue.

In talking about the other crisis situations in the Middle East and Southwest Asia, Sadat reiterated his condemnations of the Soviet invasion of Afghanistan and said it was "no secret" that Egypt is giving aid to Afghan rebels an "will contiue to aid them until they free their land."

He refused to give details of this aid, although Egyptian officials disclosed several weeks ago that Afghan insurgents were receiving training in Egypt and were being supplied with arms by the Sadat government.

Sadat also condemned Iran's continued holding of American hostages and denounced the Iranian government for justifying its actions as in accord with Islamic religious precepts.

"Excesses that have been perpetrated in the name of Islam are a disgrace to those who commit them," Sadat said. Earlier, in an interview with CBS television news, Sadat called Iran's most powerful leader, Ayatollah Ruhollah Khomeini, "a lunatic."