Two rounds of U.N.-sponsored talks on the war in Afghanistan have failed to resolve fundamental issues including the timing of a Soviet withdrawal, the role of international guarantors and the future of 3 million refugees, according to senior Pakistani officials involved in the discussions.

As a result, the obstacles to be confronted when talks resume in Geneva on June 7 appear to be large and possibly insurmountable. The Soviets and their Afghan Army allies recently have launched the heaviest air and ground attacks on Moslem insurgents since Moscow intervened nearly 3 1/2 years ago, and the likelihood is for continued bloody fighting, according to Pakistani, western and rebel sources.

In Washington, the State Department on Friday accused the Soviet Union of causing hundreds and probably thousands of civilian casualties in Afghanistan in recent bombardments that were "intolerable by any standard of civilized behavior."

"We cannot stand silently by and witness this slaughter," chief spokesman John Hughes said. He said that numerous reliable reports from Afghan refugees and other sources "leave no room for doubt" that civilian casualties have been "extremely heavy."

Despite optimistic public predictions by diplomats and U.N. officials following the indirect negotiations between Pakistan and the Soviet-installed Marxist government in Kabul, Pakistani officials admit privately that no comprehensive plan has taken shape that could end the conflict soon.

Responding to claims by U.N. special envoy Diego Cordovez that the talks in Geneva have produced agreement on 95 percent of the issues, an informed Pakistani source said, "in terms of verbiage and the number of paragraphs, yes. But the final 5 percent may be crucial. It may make or break the talks."

The fundamental question of which would begin first--troop withdrawals or internationally supervised guarantees of noninterference--is far from being resolved, informed Pakistani sources said. Also unresolved is the crucial issue of what kind of government would be left in Kabul if the Soviets withdraw.

Because of the political and material sacrifices that the Soviets would have to make in withdrawing, there is a growing belief here among some Pakistani officials and western diplomats that the Russians may use the obstacles in negotiations as a stalling tactic while continuing to try to wear down the insurgency.

Several officials observed also that new Soviet leader Yuri Andropov may want more time to consolidate his position at home before making the kind of drastic decision that a settlement would entail.

A Foreign Ministry official here said that expressions of optimism by Pakistani President Mohammed Zia ul-Haq and Foreign Minister Sahabzada Yaqub Khan should be viewed as interpretations of progress as a cumulative or evolutionary process. The official accompanied Yaqub to China last week and will travel to Washington, London, Paris and Moscow to generate support of the talks by the permanent members of the U.N. Security Council.

Pakistani officials also sought to put into perspective Zia's statement to a British television interviewer on May 11 that "the Russians are saying they want to withdraw, and we're taking them at their word."

The Foreign Ministry official said, "The Soviets have said they are willing to withdraw. It wouldn't have done any good if we were to start the negotiations saying they have no intention of withdrawing, so we say, 'Okay, we will put you to the test.' To continue the negotiations, we have to do that."

A senior western diplomat who has followed the negotiations closely put it more bluntly: "The Pakistanis have to be upbeat, or they will be accused of scuttling the talks. But I don't believe they are hopeful. The fact is, the Soviets haven't given ground on anything."

Another senior western diplomat said, "It's illusory to say that 90 percent of the text is settled when the 10 percent could be crucial. I'm still taking an agnostic positon."

In the border city of Peshawar, leaders of the Afghan insurgency voiced a similar note of pessimism while reiterating their refusal to participate in the Geneva talks unless they can negotiate directly with the Soviets and not with representatives of the Moscow-backed government of President Babrak Karmal.

"We are skeptical. We don't even know if our viewpoints have been presented, and in any case, the outcome will have no meaning if we are not included," said Mohammed Haikim Aryubi, former Afghan consul general in Karachi and now commander of the National Islamic Front guerrilla force in Paktia Province.

Abdul Haq, Kabul area commander of the fundamentalist Bezbi Islami resistance organization, said, "It's just tricky business. If the Soviets were going to leave, they wouldn't be spending so much money building airports, rail lines and roads. What is that for, a gift to us?"

But Aryubi, who represents the resistance's moderate alliance, said he saw some promise in the Pakistani overtures to the permanent representatives of the U.N. Security Council.

"Maybe the issue can be taken away from the regional context and put in the global context if the big powers are involved. Maybe the Security Council can guarantee the principle of noninterference," he said.

The negotiators are far from agreeing on how to stem the flow of insurgents and arms across the porous frontier between Pakistan and Afghanistan and thereby guarantee the noninterference that the Soviet Union is demanding.

The Soviets are said to have flatly rejected the notion of a U.N. or multinational peace-keeping force, and instead have suggested vague formulas under which the United States, China and the Soviet Union would act as guarantors of noninterference. Their functions in such a role have not been defined.

The Pakistanis are demanding that specific duties of the guarantors be drafted and that they be installed simultaneously with the withdrawal of the more than 100,000 Soviet troops in Afghanistan, according to sources close to the talks. But the Soviets have agreed to neither proposal and instead have floated vague ideas about satellite surveillance, the sources said.

Equally formidable is the problem of what form of government would rule Afghanistan after a Soviet pullout. The resistance groups have ruled out a communist presence in any coalition government, but it appears highly unlikely that the Soviets would go along. For Moscow, such a concession would constitute for the first time in its history an admission of failure of what it labels a Marxist revolution, an acknowledgement that could have enormous implications in Poland and elsewhere in the world.

"The Soviets always say, 'We want to withdraw but the process of revolution is irreversible,' " a Pakistani official said.

Also working against a settlement are the problems of how to attain a consensus among the fractious and frequently battling Afghan resistance groups, and how to rebuild an indigenous army that could protect whatever government was installed and prevent civil war.

Resistance leaders in Peshawar spoke hopefully of a transition peace-keeping force of 20,000 troops drawn from Islamic Conference nations, but it appears unlikely that the Soviets would agree to such a foreign presence close to their southern border.

The issue of the return of about 3 million Afghan refugees in Pakistan and Iran also presents a hurdle because so far the Soviets have not acceded to the Pakistani demand that the refugees be consulted about the repatriation process.

Diplomatic observers noted that the cost of the war, estimated at between $3 million and $4 million a day, is not an intolerable one for the Soviets. They also noted that Soviet casualties, estimated at 1,200 a year, are minimal for a country with 3.6 million persons under arms. But the Soviets are paying a price in lost prestige in the Islamic world, erosion of detente with the United States and difficulties in Sino-Soviet relations. It is this debilitating combination upon which the Pakistanis are basing their hopes for an eventual settlement.

Because of concern for its own position in the Islamic world and its close ties to the Soviet Union, Pakistan hardly can afford to sign an agreement with the Soviets that would be regarded as a sellout by the Afghan refugees and resistance fighters, Pakistani officials conceded.

It is unclear whether a solution will have to entail some kind of a global trade-off for the Soviet Union. One diplomat suggested that the Soviets would have to be offered something more than just an improvement in U.S.-Soviet relations and a refurbished image in the Islamic world it it is expected to admit defeat in what it regards as a Marxist revolution.

A Washington Post staff writer added the following:

State Department spokesman Hughes said civilian casualties in the recent raids were especially heavy near Herat, Afghanistan's third largest city, and in the areas north and west of Kabul.

"It is not possible to measure precisely the extent of these casualties, but they certainly number many hundreds and are probably in the thousands," he said.

"Such a massive and ruthless assault on a people who are, for the most part, without any means of defending themselves is intolerable by any standard of civilized behavior," Hughes said.

"It would appear that the Soviet Union believes that the world is either unaware of or no longer cares what it is doing in Afghanistan and that, in its desperation to subdue the spirit of the vast majority of Afghans who yearn for their nation's freedom, it is willing to employ any means, no matter how brutal," he said.