Israeli Prime Minister Menachem Begin congratulated Bashir Gemayel today on his election as president of Lebanon, wishing him success in his "historic mission on behalf of the liberty and independence of Lebanon."

Gemayel is commander of the Lebanese Forces, a Christian militia that has been an ally of Israel. Sources here say Israel is looking to him to restore the "independence and sovereignty" of Lebanon.

The Israeli Foreign Ministry issued a statement saying, "We are pleased that the people of Lebanon have succeeded in democratically electing a new president."

Israeli officials also defended their decision to block the departure of a ship carrying Palestinian guerrillas from Beirut yesterday because it contained equipment the Israelis say is barred by the evacuation agreement.

Israel's defense of its brief blockade of Beirut harbor, which ended after U.S. officials provided assurances that the equipment would be unloaded from the ship before the guerrillas landed in Tunisia, was voiced by Uri Porat, Begin's chief spokesman, and other officials.

Porat said Israel expects that all agreements it is a party to, including the plan for the evacuation of the Palestine Liberation Organization guerrillas from Beirut, will be followed "to the letter." He said there is no question that by loading jeeps, rocket-propelled grenade launchers and a handful of Palestinian civilians on the ship, the PLO had violated the evacuation agreement.

Jeeps and other vehicles were unloaded in Cyprus today from the ship carrying PLO fighters to Tunisia. There were no independent reports of heavy weapons or civilians being on board.

Israel argues that under the agreement the guerrillas are allowed to take with them only personal weapons such as rifles, not heavier equipment, and that the presence of the women and children among those who were departing could confuse the counting of exactly how many of the trapped PLO fighters were leaving Beirut.

Porat was reacting to statements by Defense Secretary Caspar W. Weinberger that the Israeli warships that delayed the departure of the ship for its initial stop in Cyprus had no right to be in the harbor under the terms of the agreement.

Porat's reference to Israel's insistence on strict adherence to all existing agreements was interpreted here as another signal to Washington not to try to alter the Camp David peace accords.

Yesterday, Begin announced that Israel soon will launch its own "comprehensive" Middle East peace initiative, but he warned that Israel will not consider any proposals that "deviate" from the Camp David formula of providing an interim five-year period of autonomy for the Palestinian residents of the occupied West Bank and Gaza Strip.