Gen. Boris Gromov, the Soviet commander in Afghanistan, denied charges that soldiers aboard Soviet helicopter gunships shot their encircled comrades to keep them from being taken prisoner by Afghan rebels.

Gromov told the Soviet army newspaper Krasnaya Zvezda on Tuesday that he was bewildered by the charges made by dissident Andrei Sakharov Feb. 5 in Canada."I state definitely that there had not been nor could there have been facts so monstrous," Gromov said. "The command knew of all instances of Soviet troops encirclement and adopted urgent and effective measures to help them out.

"The reality totally rejects the inventions of incompetent people and attempts of those who spread them," said Gromov, who was the last Soviet soldier to leave Afghanistan Feb. 15, completing the withdrawal of 100,300 troops from the futile nine-year war that embarrassed the Kremlin internationally and caused discontent at home.

Sakharov, the winner of the 1975 Nobel Peace Prize for his human rights activities who was freed from six years of internal exile by Soviet leader Mikhail Gorbachev in 1986, stood by his statement, his son-in-law said.

"He believes his statement to be the accurate one. It's confirmed by the testimonies of the captured Soviet soldiers," Efrem Yankelevich said in Newton, Mass., where Sakharov is visiting with his wife, Yelena Bonner.

Being taken prisoner was dreaded by Soviet soldiers because of reports of mutilation at the hands of the anti-communist, U.S.-backed Moslem fighters.