The images of Afghanistan come back in the Soviet Union:

In Kabul, on Chicken Street, two Russian soldiers, kids almost, wandering aimlessly, wondering what they were doing there, asking a visitor whether the Soviets had won a recent soccer game.Artyom Borovik, a Soviet journalist, leaving on a plane from Afghanistan, describing how so many of the soldiers had become drug addicts, about how so many had been captured and tortured by Afghan rebels.

The rising temper of a 30-year-old Moscow writer as he stood in the evening rain, the glare of lights banking off the street, accentuating his anger. "Why are we helping them?" he asked, meaning the Afghans. "Why are we wasting our arms and our lives on those people, on those illiterates?"

The 12-year-old Afghan in a dusty village outside Kabul, fighting for the Soviet side, firing gun blasts with a big rifle, teaching his 11-year-old brother how to master the weapon.

All can rest a little easier now. After more than eight years of death and misadventure and nightmare, the Russian boys are coming home. Out of Afghanistan. Back to a country that is not supposedly militarily insuperable, that has never greeted its losers well.

But are they losers? From the Soviet perspective, was it all such a calamity? Or did Moscow achieve what it set out to do?

Had the Red Army not stormed over the borders that Christmas week in 1979, would not Afghanistan, then on the edge of civil war, have fallen into Western hands and become a security threat on the border?

Many Soviet citizens believe it would. They believe the bloodshed there might have been as bad or worse these past years had their boys not sacrificed themselves to the tune of 10,000, or 20,000 or 30,000. (No one outside the Kremlin knows the number of war dead.)

And many veterans of the occupation will tell you that with the big red machine set to begin departing May 15, the war among the Afghans will not end but only intensify.

With the United Nations-sponsored agreement recently signed, come the imponderables. Some are reminiscent of the questions asked in Washington after the withdrawal from Vietnam.

Why didn't the Kremlin send in 200,000 more soldiers to wipe out the enemy? Why weren't atomic weapons used? What will the other Soviet client states think of the bear that has bowed out? Does the experience of Afghanistan mean the Soviet Union cannot be the world's policeman? Is the so-called Brezhnev doctrine once in the Soviet camp, always in the Soviet camp repudiated? Was Afghanistan ever really in the communist camp? What will be the reactions of the Soviet Union's military hierarchy and of the KGB to Mikhail Gorbachev's decision to back down?

Some of the answers, one diplomat said here this week, may be linked to the new politics. The Soviet Union is moving away from the principle that military force is everything. The new politics, the "new thinking" as Gorbachev calls it, demands this. And the withdrawal of 115,000 troops from Afghanistan fits the rubric. When was the last time the Soviets of their own volition, de-occupied a significant land mass? Was it Austria, 33 years ago?

Rationalizing a pullout after eight years in Afghanistan is not easy for the Kremlin, but it is helped by the new politics of international dialogue, of arms reduction, of across-the-board conciliation. How significant is little, illiterate, impoverished Afghanistan when the boss is making headway on no-nukes and the sunniest detente ever envisaged?

Soviet leaders have claimed (and still claim) that Afghanistan was never the big offensive strategic chip, the route to a warm-water Indian Ocean port that scaremongers in the West warned it was. Instead, the Kremlin insisted, the invasion had the same purpose as other Soviet military incursions perimeter defense.

With the Soviets gone, no fewer than 17 groups will be contending for power, many of them stocked with the most modern of Western or Soviet armaments.

The groups fit into four camps. One is President Najibullah's People's Democratic Party of Afghanistan. A second consists of the supporters of ex-king Zahir Shah, who, living in Rome, is rumored to be contemplating a return. There is also the eight-party Alliance of Islamic Revolution, based in Tehran, and the seven-party Islamic Unity of Afghani Mujahedeen, anchored in Pakistan.

Diplomats say that Zahir Shah, though 73 and absent for 15 years, remains the most popular choice among Afghans and might have the authority to establish a durable government.

For the Soviets the biggest worry is the advent of an Islamic regime in Kabul. Afghanistan borders on heavily Islamic Soviet Central Asia, and Moslem guerrillas fighting the Kabul government have fired rockets into Soviet territory. On at least one occasion they have crossed the border in Tadzhikistan, killing two Soviet guards. Radio broadcasts from Pakistan have been pouring into Tadzhikistan with calls for Islamic solidarity and denunciations of the Soviet war effort.

There are many in Moscow who believe, despite the words of chief Soviet government spokesman Gennady Gerasimov, that the Soviets are simply not in a position to guarantee they will never have to re-enter Afghanistan.

"We will think twice, thrice, before we move in again," Gerasimov said. "I think it's not going to happen. An intervention like this is not going to happen."