Much of the Afghan population has hated the Soviets ever since their troops arrived to shore up a tottering communist regime nine years ago.But now the soldiers are on their way out, it is the very Afghan officials the Russians came to bail out who are openly bitter at the Soviets.

The Kabul government feels abandoned by its protectors as Afghan guerrillas prepare for their biggest onslaught against the regime with the support of their chief backer, the United States.

Denouncing the Soviets has become almost fashionable within the middle and lower ranks of the ruling People's Democratic Party of Afghanistan, according to official sources.

"Until about four months ago everybody in the PDPA was saying the Russians are our good friends," said an Asian diplomat with extensive contacts in the ruling party. "But that has changed quite radically. A lot of people now speak badly about the Russians."

The turnabout can be traced to the April 14 signing of the Geneva agreement that provided for the withdrawal of more than 100,000 Soviet troops by next spring. At the time, the war-weary population of Kabul had high hopes for peace.

The party leadership apparently sincerely believed Soviet assurances the agreement, guaranteed by the United States and the Soviet Union, would produce peace.

When the guerrillas instead intensified the fighting, helped by continuing U.S. arms supplies, the rulers in Kabul expected the Soviets to back out of the deal and leave their troops in Afghanistan.

But Soviet leader Mikhail Gorbachev had promised his people that all the troops will be home by February. His domestic credibility and popularity were at stake and, after nine years of futile warfare, he was determined to get out.

When Afghan officials realized Moscow would not provide salvation, the mood in the party underwent a dramatic change.

"They are telling me openly that they hate us," a Soviet resident said. "They say that we created a big mess when we quite unnecessarily brought the army here and now we're leaving them in the ditch to face the consequences."

Party members now say the Soviets betrayed them for the sake of their own domestic politics and geopolitical priorities, including improved relations with the United States and China.

Soviet deals with resistance field commanders to refrain from attacking Russian troops during the nine-month withdrawal that began May 15 also fueled Afghan anger.

Afghan politicians and military commanders said "the Soviets had cordially invited (the guerrillas) to concentrate their firepower on the units of the Afghan army only," said one Third World diplomat. "Naturally they were not pleased."

While independent analysts believe it extremely unlikely the guerrillas will be able to capture Kabul in the near future, the mood of the party is clearly downbeat.

Many of the rocket barrages the rebels frequently launch on the city are aimed at a government housing area called Macrorayon. The casualty toll among inhabitants is high.

The rockets land in Kabul with ever-increasing frequency despite a protective cordon of Soviet positions around the capital and helicopter patrols to detect attackers. When the Soviets go, the situation around Kabul is bound to deteriorate.

"We trusted them to stand by us," said a grim civil servant. "Now that our enemies attack like never before, they say goodbye and go home."