Soviet troops came to Afghanistan "with open hearts" to perform an honorable task and now leave with a feeling of failure, a Red Army general says.

But Maj. Gen. Lev Serebrov said Sunday that the Soviets' withdrawal after nine years in Afghanistan compared favorably with the U.S. exit from Vietnam."Your generals ran away from Saigon," he told an American reporter at a news briefing. "But we have a withdrawal that is proceeding according to a timetable."

Serebrov, dressed in camouflage uniform and chain-smoking, said Soviet officers were communicating with guerrilla commanders on parts of the Salang highway, the main route to the Soviet border, to try to keep it open so supplies can get through to the embattled Afghan capital.

"We have not succeeded in everything we planned to do here," said Serebrov, a political officer at the military high command in Kabul. "We came here with an honorable task, with open hearts . . . We are leaving and we have a sense of not having accomplished our mission to the end."

Under a U.N.-mediated accord signed in April, the Soviets' 100,000 troops began leaving Afghanistan on May 15, and half were out by Aug. 15. The remainder are to leave by Feb. 15.

The Soviets, who have lost more than 13,300 men in the conflict, announced late last year they had indefinitely suspended the withdrawal of remaining troops because of continued U.S. and Pakistani aid to the guerrillas.

Serebrov disputed reports by Western diplomats that the withdrawal had resumed in earnest in early January.

But hundreds of fully equipped Soviet troops are daily seen boarding giant Ilyushin 76 transport aircraft that lift them out of Kabul and Afghan government troops now man former Soviet posts on the perimeter of this beleaguered capital, not far from guerrilla positions.

Asked how the Soviets planned to evacuate all troops within 31/2 weeks in bitter winter weather, Serebrov said: "That's our problem."

Pressed about visual evidence of troops leaving, Serebrov, speaking through an interpreter, argued that the departing troops had merely completed their two-year military service and "are being replaced with new ones."

"We are ready . . . to end the withdrawal by Feb. 15, but we have not yet received the order to start the final stage of withdrawal," he said.

He dodged questions about reports, including from one Soviet source in Kabul, that the military high command will move from the Afghan capital to the town of Hairatan on the Soviet border between Jan. 31 and Feb. 2.

Asked how the commanders will go if they remain in Kabul until the deadline, he said, "We will find a way."

The Red Army intervened in Afghanistan in December 1979 and replaced one pro-Moscow regime with another. Moslem guerrillas have been fighting the government since the communist seized power in an April 1978 coup.