A SHOVING MATCH is building between Israel and the United States over Lebanon. Perhaps it is unavoidable. Perhaps accepting such a confrontation is the only way open to the administration to convey to Israel that it must end its occupation promptly. There is no denying it is unpleasant, and even somewhat dangerous on the ground.

In Lebanon, Israeli troops have recently been testing the discipline and seriousness of American peacekeeping units, nudging them and then complaining that the Americans let guerrillas sift through--a literal shoving match. One such incident produced the disturbing headline, "Marine Had Israeli in Rifle Sights," in yesterday's newspaper. The Pentagon, publicizing these incidents, is dramatizing its institutional coolness both to Israel and to the sending of American troops to Beirut. No matter: the Israeli "nudging" must cease.

The root of the trouble is plain. Having expended much blood, treasure, national standing and political credit in Lebanon, the Begin government seeks the fullest possible political and security compensation for withdrawal. Lebanon's government, however, could lose what slight claim it has to national authority if it bows to Israel's current terms. To even the odds in this negotiation of unequals, President Amin Gemayel has enlisted American support.

Entirely rightly, the administration has taken as its priority to free Lebanon of foreign armies and, not so incidentally, to establish that American policy is made in Washington, not Jerusalem. This latter demonstration is essential to, among many other things, drawing Jordan into support of Mr. Reagan's promising but languishing Palestinian initiative of last Sept. 1.

Israel is discovering that it continues to lose soldiers in Lebanon and that politically the place is a morass. Most Israeli voters seem ready to support an exit on terms offering reasonable border security, which the Lebanese appear ready to give. But Mr. Begin and his key ministers demand more: political advantage for friendly Christian elements and a certain framework for future relations.

Everyone in the Middle East knows that the Israelis, no less than their fellow occupiers, the Syrians, are going to keep a hand in Lebanon even after withdrawal of their own forces. But in this stage it is important to get the foreign forces formally out--and to keep the peacekeepers, in expanded strength, in.

The Begin government has eased off some of its early demands on Lebanon, but it has a way to go. Its single legitimate concern is border security. The United States must keep using its influence to pare back Israeli demands to that essential core.