ON THE SALANG PASS, Afghanistan (AP) _ Young soldiers had reason to cheer along this dusty, rutted road lined with the burned-out skeletons of tanks and trucks and bombed-out mud-and-brick villages.

They had wrested control of the road to the Soviet border, the lifeline for the capital, Kabul.

Until a month ago, it had been under the control of rebel commander Akmed Shah Masoon and his Jamait-i-Islami group, who frequently clamp a stranglehold on the route and cut off essential supplies of food and fuel.

And the soldiers appeared more determined than ever to keep it from falling back into Masood's hands.

''If he tries to take it again, we'll teach him a lesson he won't forget,'' said one 30-year-old soldier, who gave his name only as Capo.

On Wednesday the government took a small contingent of foreign journalists along a 20-mile stretch of the highway. It was the first such trip since the Soviet Union 2 1/2 months ago pulled out the last of its troops who had been supporting the Marxist Afghan government.

Along the road that winds through the majestic Hindu Kush mountains north toward the Soviet border, the soldiers stood beside their embattled roadside checkpoints and mountaintop observation posts as the small caravan of armored personnel carriers passed.

Some of the soldiers saluted. Others waved or applauded. For them, it was their moment of triumph in the midst of widespread destruction. Nothing stood intact from years of shelling and bombing.

Their success would not have been thought possible in mid-February, when the Red Army ended nine years of military involvement in Afghanistan. Many people predicted the Afghan armed forces would be plagued by mass defections. Those who did not switch sides - according to one line of conjecture - would not be able to stand on their own against the guerrillas, armed and supported by the United States, Pakistan, Saudi Arabia and China.

Brig. Gen. Mohammad Shafi said his group proved them wrong.

''It needs no further explanation. You can see for yourself,'' said Shafi, who assumed commnd of the infantry unit that guards the road a few weeks before the final Soviet pullout.

The village of Bagh-e-Maidan, about 65 miles north of Kabul, is proof of the devastation of 11 years of fighting between the Afghan armed forces and the Moslem guerrillas.

''Masood was responsible for this,'' Shafi said of the ruins that were once an ancient village carved in the mountain.

But some soldiers under his command disagree.

''The Russians did it,'' said one soldier.

The soldier, who spoke on condition that he not be identified, said about 500 people were killed in one pulverizing raid on Bagh-e-Maidan.

Shafi estimated that 180 villages in the area had been destroyed over the years. No one knows how many people were killed.

The United States earlier this year accused the Soviet Union of ''carpet bombing'' to clear the area before the final Red Army pullout on Feb. 15. The Soviets denied it.

But in late January, the Soviet and Afghan armed forces launched a three- day offensive with bombers, artillery and tanks to clear the Salang. Officials said at least 650 people were killed.

About four miles farther north, the smell of smoke permeates the air and the roadside is cluttered with rows of destroyed tanks and supply trucks.

Soldiers said the rebels had stopped the vehicles and demanded some kind of toll to pass through. If they refused, the driver was shot and the vehicle was doused with fuel and set ablaze,the soldiers said.

A month ago, the military moved in and cleared the area in a gunbattle that left at least 250 rebels dead. Masood's lieutenant, Abdul Bashir, was wounded but escaped, Shafi said.

About 400 government troops occupy the area now.

''There hasn't been a major battle since then,'' Shafi said.

And he said the road has been open for columns of supply convoys to move toward Kabul.

On Tuesday night, the general said, 1,800 trucks and tanks began moving slowly toward Kabul and would reach the capital soon.

The convoy had not reached the city of 2.25 million by Wednesday night.

Soon, he said, it may not matter. The government has been constructing another route to detour through the rebel-controlled areas.