The quick stroke and counterstroke of violence in the Middle East have altered the equation between President Carter and Prime Minister Menachem Begin. Begin, who was in a very weak position before the most recent events, is now solidly placed to resist American pressure.

Paradoxically, though, the Israelis may eventually rue the advantage they have gained. For they can use it only to draw Egypt toward a separate peace - a goal that has in fact been made more difficult by the latest events.

Before the Palestinian terrorist attack a week ago last Saturday, Begin was a man beset on every side. His policy of favoring Jewish settlements on occupied Arab land and of refusing to yield any territory on the West Bank of the Jordan had earned him universal disaopproval.

All Arab states condemned the settlements and the hard line on the West Bank. Egypt had broken off the negotiations set in motion by President Anwar Sadat's visit to Jerusalem. President Carter was determined to force Israeli concessions, and had mounted various pressures including withholding of promised aircraft.

More important still, there were domestic difficulties. The labor opposition in the Israeli parliament had come out against both the settlements and the hard line on the West Bank. Defense Minister Ezer Weizman, the No. 2 man in Begin's own party, had expressed reservations about the settlements.

In those conditions, indications were that Begin would have to yield to American pressure to stop the settlements and to ease his stance on the West Bank. Once he yielded, the United States would be in a fair position to persuade Egypt to pick up the thread of negotiations again.

But the strike by the Palestinian terrorists and the deliberate flaunting of the action by Yasser Arafat, the supposedly moderate Palestinian leader, changed all that. The security issue was dramatized in Israel and for all the world. The opposition and, even more, Defense Minister Weizman rallied behind the prime minister.

The invasion of southern Lebanon by Israeli forces, and the cleanup of Palestinian bases, strengthened the prime minister further. Israel did deal in a relatively discriminating way with an undeniable problem. All members of the government and the opposition and the vast majority of the country backed the operation. A great many non-Israelis in Europe, this country and even parts of the Arabic world sympathized with their action.

Moreover, the issues of Jewish settlement and the West Bank on which Begin was so vulnerable have now been shoved lower down on the agenda. Topic A is now the withdrawal of the Israeli troops in Lebanon that the Carter administration proposed last Thursday.

In these circumstances Begin is almost under no pressure to adjust his position on the settlements or the West Bank. On the contrary, he can assert that it is up the world to prove its concern for Israeli security by doing something about the problem of southern Lebanon. He can insist that the United States prove its good faith by pushing Egypt to hang on in the peace negotiations.

The trouble is that Egypt is now more than ever isolated in the Arab world. President Sadat was alone in condemning the terrorist attack on the Israelis. While still standing for talks with Israel, he has not been able to resist joining the general Arab denunciation of the Israeli occupation of southern Lebanon.

A swift Israeli withdrawal from Lebanon might just give a lift to the talks between Cairo and Jerusalem. It would prove that the Israelis were indeed prepared to yield territory for security.

But absent that, Egypt will find it harder than ever to go forward with the talks. The fact is that the Lebanon occupation strikes the Arab world as still another instance of Zionist aggression. Which means that the Palestinians have probably come closer to their goal of destroying the negotiations than the Israelis have to their objective of a separate peace.