JAVIER PEREZ DE CUELLAR, secretary general of the United Nations, is out in the Persian Gulf trying to get Iran and Iraq to call off their savage war. Perhaps nobody can do it, but if anybody can, he's the one. He was not tainted when the Security Council disgraced itself at the beginning of the war by, in effect, giving Iraq a green light to beat up on Ayatollah Khomeini's Iran. Later, Mr. Perez de Cuellar used the powers of his office to do what he could to reduce the impact of the war on noncombatants. He stirred an initiative, complete with eight-point plan, to call the council to its proper peacemaking function. When the council finally did pass a resolution for a cease-fire and negotiations in July, he was well positioned to use the new consensus to launch the mission he now is on.

The Iranians are bitter to the point of arrogance in their war aims, and Iraq is desperate in fear of defeat and disgrace. Both, however, are feeling the immense costs of the war: casualties in the hundreds of thousands, economic losses in the tens of billions. Both are also feeling the outside world's increasing urgency, so much so that the special purpose of each country's diplomacy now is to deflect onto the other any onus for interfering with the secretary general.

Iran has sought to pick among the separate elements of the U.N. peace resolution. Mr. Perez de Cuellar is absolutely right to insist that the resolution is a package -- carefully contrived to offer something to both countries -- and that the Iranians, whether out of wile or internal differences, cannot select out parts of it. Iraq is being selective in another way, complying less than fully with the temporary cease-fire the secretary general necessarily demanded as a condition to productive involvement.

The United States, alienated as it is from Iran, has been out of the running from the start as a potential mediator; its secret dealings with Iran did it no service. Recently, the Soviet Union, which has cultivated access to both sides, has been trying to establish itself as a mediator (even as it has supported Mr. Perez de Cuellar). Gulf countries, however, have made it plain they prefer the United Nations, which, whether it succeeds or not, does not put or leave the Soviet Union in a favored regional position.

Probably the most a prudent person can ask from the Perez de Cuellar mission is the onset of a cease-fire (in all theaters), which would warm the climate for opening negotiations. Iran and Iraq take grave risk by resisting this minimal goal.