United Nations, N.Y.
The prospects for a peaceful solution to the Afghan dilemma are improving, according to high officials involved in the effort to work out a negotiated settlement.
United Nations-sponsored talks this week in Geneva may lead to a preliminary accord before the end of the month that would permit a Soviet pullout from Afghanistan - while leaving behind a government friendly to the Soviets, sources here say.
The agreement would probably require neighboring Pakistan to terminate any support for Afghan guerrillas operating out of numerous refugee bases in Pakistani territory.
The meetings beginning June 16 in Geneva are the third round of indirect talks between Afghanistan and Pakistan. A final and decisive breakthrough is not expected at this time, but the parties may announce an accord before the end of the month ''which would mean that 97 percent of the draft agreement will have been drawn up,'' says one reliable source.
''The remaining 3 percent of the agreement, or, if you wish, a small number of crucial loose ends, will still have to be tied up. This is unlikely to happen before a . . . deal is struck between the US and the USSR at the top,'' says a diplomat in touch with all the interested parties in the crisis.
''Yakub Kahn (Pakistan's foreign minister), Muhammad Dost (Afghanistan's foreign minister), and Diego Cordovez (UN undersecretary-general) are currently cooking the pudding, but only Reagan and Andropov, if and when they step into the kitchen, can give it its final shape,'' says a former ambassador to the Afghanistan.
Indeed, the US attitude toward a Soviet pullout from Afghanistan will be critical. Washington holds several trump cards which it can play one way or another, officials say.
''It (the US) can either make it easier or more difficult for the Soviets to withdraw from Afghanistan,'' says an Asian diplomat. Other analysts concur with this view.
As they see it, there are three main elements of a package by which Afghanistan's former status quo as an independent but friendly neighbor of the Soviet Union could be restored and by which it could once again play its historical role as a buffer state. These are:
* The phased pullout of Soviet troops.
* The gradual return of Afghan refugees to Afghanistan.
* International guarantees by the members of the Security Council - foremost the Soviet Union, China, and the US - of nonintervention in the internal matters of Afghanistan.
The Soviets are eager to extricate themselves from Afghanistan because the price they pay for their occupation of that country is high in human lives and money. Moscow also worries that its role in Afghanistan tarnishes the Soviet international image, say some of the Soviets' closest allies.
However, the Soviets wants ironclad guarantees that Afghanistan will not become a hostile neighbor, says a high UN official. They will settle for nothing less than this. ''They are not desperate and they will not allow themselves to be humiliated,'' the source says.
But the Reagan administration does not appear to be willing, at this point, to roll out a red carpet for the Soviet exit from Afghanistan. The US finds it advantageous, sources say, to have the Soviets trapped in Afghanistan, which embarrassed them internationally.
''It is their (the Soviets') Vietnam,'' says one US diplomat.
Just as earlier UN peace efforts were getting under way in Geneva two months ago, the Reagan administration leaked details of US military support to the Afghan guerrillas to the press. The leaks nearly derailed the talks, sources say.
If Pakistan is not sufficiently forthcoming at Geneva, the Soviets could stir up separatist sentiment in the Baluchistan region of Pakistan, analysts say.
''If Pakistan shows too much softness in Geneva, it risks losing its vital US economic and military support. If it is not flexible enough, it may encur the wrath of the Soviets and its social and political stability may be threatened,'' says one Asia expert.
Pakistan's Yakub Kahn recently visited Riyadh, Washington, London, Paris, Peking, and Moscow in pursuit of a settlement. And it looks as though Diego Cordovez, who is acting as UN Secretary-General Javier Perez de Cuellar's special representative in Geneva, may be able get an announcement of a precise timetable for as troop withdrawal from the Soviets and guarantees from the US, China, and others of nonintervention in Afghanistan's internal affairs.
Even if these agreements in principle are achieved, a UN plan would still have to some very thorny problems ahead:
* The phrasing of an agreement of nonintervention would be tricky. Under what circumstances would Soviet troops be allowed to return into Afghanistan in order to quell a rebellion? Who would act as a referee and say whether a pariticular uprising is purely local or whether it was engineered by ''foreigners''?
* How will the guerrillas be represented in a new, broader-based regime in Kabul? Who will unite them? (There is no military, ideological, or political unity now.)
* How will a new regime in Kabul be selected and how will it be both representative of a majority of its people and acceptable to the Soviet Uniion.