Soviet and Afghan Army forces claimed success today in their two-week-old offensive to gain control of the strategic Panjsher Valley, but informed Afghan sources here said it appears that the resistance fighters merely have retreated to the surrounding mountains.

If the claims of Radio Afghanistan are correct, this is the first time in five attempts over the past 18 months that Soviet and Afghan troops have managed to take control of the 100-mile-long valley, which begins just 60 miles northeast of the capital of Kabul.

"The centers of bandits and counterrevolutionaries have been liquidated forever," Radio Afghanistan announced in its first word on the battle, which started May 17.

But usually reliable Afghan sources here, with close connections to their homeland, called the Soviet victory "temporary."

"They captured the area, but they are likely to pull out in a couple of weeks," said one former Afghan government official living here. "The terrain is so difficult the Russians are not able to avoid snipers from the mountains."

He suggested that the Soviets had secured the valley by launching a three-pronged offensive--laying a pontoon bridge over the Panjsher River and moving in from Nuristan to the east and the Salang Pass to the west. At the same time, he said, the Soviet-installed Afghan government was able to gain or buy the support of some influential valley residents.

It was unclear until today whether the Soviet offensive had succeeded. Western diplomatic sources here, while reporting the Soviet assault, had carefully hedged on whether the valley had been taken.

One Western diplomat said many Kabul residents were certain that the rebels had won, mainly because nothing had appeared in the official media. But the diplomat also said there were reports of intense fighting and stories circulating that the Soviets had captured a number of key villages, including Rokha, the principal one in the valley.

There was ample information, however, indicating that the Soviets took heavy casualties in their attack.

An Afghan who arrived here from Kabul reported seeing busloads of wounded Soviet troops taken into the military hospital in the capital, and diplomats reported that a heavier-than-normal proportion of beds in Kabul's best hospitals contained wounded Russians. Furthermore, the diplomats said an increased number of dead and wounded Soviet soldiers were seen at Kabul airport being sent back to the Soviet Union.

Resistance sources in Pakistan, meanwhile, claimed massive victories that diplomats could not confirm. Last week, for instance, one Peshawar-based group said its fighters in Panjsher had killed 700 Soviet and Afghan soldiers.

Another group said this week that rebels had attacked the Soviet airbase at Bagram, 30 miles north of Kabul, in retaliation for the Soviet offensive.

The leader of that group, Burhanuddin Rabani, told The Associated Press in Islamabad, Pakistan, that reports of a Soviet victory in the Panjsher were inaccurate.

The Panjsher, long a resistance stronghold, is considered strategic because it controls one route to Bagram, one of the largest Soviet military installations in Afghanistan, and because it is a main infiltration route for rebels moving toward the province of Badakshan on the Afghan-Soviet border.