The Afghan accord to be signed this week represents a rare victory for U.N. dipolmacy in resolving regional conflicts. It also indicates the limitations of the world body.

The United Nations is only as good as its 159 members, only as constructive as they allow it to be, only effective when the superpowers embrace it.

Nearly six years of intensive, intricate and innovative U.N. diplomacy concerning the 10-year Afghan civil war finally paid off because it was in every party's interest. There were 12 rounds of Geneva talks and nine shuttle missions since 1981.

Pakistan and Afghanistan have announced agreement on a package of measures providing for the withdrawal of the estimated 115,000 Soviet troops from Afghanistan. The Marxist government of President Najib has been backed by Soviet soldiers in Afghanistan since 1979.

The guerrilla forces are based in Pakistan and armed primarily by the United States. The Moslem guerrillas, who were not part of the U.N.-mediated talks, have rejected the accords and said they will press their fight to oust the Kabul government.

The United Nations and its mediator, Diego Cordovez, played the role of catalyst and broker. The negotiated accord is to be signed Thursday in Geneva.

A respected, neutral peacekeeper worldwide, the United Nations will monitor the political settlement and Soviet withdrawal.

Last-minute disagreement between the United States and Soviet Union on cutting off aid to the guerrillas and the Kabul government threatened to wreck the pact.

A behind-the-scenes agreement between the superpowers, guarantors of the Afghan accord, cleared the way for success.

Diplomatic sources said the two powers tacitly agreed to cut off aid to both sides or to provide an equal amount of supplies.

The fundamental obstacle was cleared when the Soviet Union decided that Afghan intervention was too costly _ in money, lives, domestic politics and international image. Moscow then announced it would withdraw its troops over a 10-month period begining May 15.

No amount of U.N. diplomacy could achieve a breakthrough until the Soviet Union was ready to leave, diplomats said.

"Diplomatic success is possible only when the moment is ripe," said Robert G. Neumann, former U.S. ambassador to Afghanistan and now director of Middle East Studies at the Center For Strategic and International Studies in Washington, D.C. "But statesmen like ambassador Cordovez have acted with great patience to ripen the time," Neumann said on Monday in a telephone interview.

Neumann, envoy in Kabul from 1966 to 1973, said the United Nations had been hobbled because its charter prevents it from interfering in domestic affairs. Soviet insistence on a coalition government after its pullout had been an obstacle to political settlement.

When that stance was abandoned, the United Nations could act. Neumann said Cordovez "provided a catalyst as the principal but not the only actor since he was free to talk to all sides."

Cordovez says the complicated Afghan accord, which includes five separate documents, could serve as a model for resolving other regional conflicts.