JOHANNESBURG, DEC. 24 -- South Africa today rejected a new demand by the United Nations that it withdraw unilaterally and immediately from Angola, saying that it has a "direct interest" in the security of its borders and that Cuban and Soviet forces must leave the region if there is to be stability.

Foreign Minister Roelof F. (Pik) Botha, responding to a U.N. Security Council resolution adopted yesterday, said the presence of foreign troops in Angola "threatens the security of the whole of the southern Africa region.

"South Africa has a direct interest in the security of the region," Botha said in a statement issued in Pretoria. "The South African government has made it clear that it cannot allow an escalation of the conflict in the Angola-South West Africa/Namibia border area and took certain limited action in order to ensure that the conflict does not take on broader proportions."

He was referring to an incursion by South African troops last month, reportedly 200 miles deep into Angola, to help anticommunist rebels of Jonas Savimbi's Union for the Total Independence of Angola (UNITA) repel an offensive by Angolan government forces.

Both South Africa and the United States support UNITA, whose guerrillas are engaged in a 12-year-old struggle against the communist government in Luanda, the Angolan capital. Angola is supported by the Soviet Union and backed by more than 30,000 Cuban troops.

The Angolan government charged last week that 2,000 South Africans were moving north through two southern Angola provinces, Cunene and Cuando Cubango, toward the strategically important towns of Cahama and Cuito Cuanavale.

Officials in Luanda said the new thrust began Dec. 10, the date the U.N. Security Council had set for a final South African withdrawal from Angola.

The Security Council yesterday condemned South Africa for its continued occupation of parts of Angola and for delaying the withdrawal.

Botha said today that a gradual withdrawal of South African troops, announced on Dec. 5 by Army chief Gen. Jannie Geldenhuys, was "continuing under operational conditions." Botha said he would not discuss details of the pullback.

A spokesman for the Army command in Pretoria said no date had been set for completion of the withdrawal, although soldiers nearing the end of their military service had been pulled out before yesterday.

U.N. Secretary General Javier Perez de Cuellar, in a report Monday to the Security Council, said that while Pretoria claimed its troops were being withdrawn, Angola insisted South African troops were still present and engaged in hostilities. He quoted the Angolan Defense Ministry as saying a total of 7,000 South African troops were still operating in southern Angola.

Responding to that report, Botha said Perez de Cuellar's mission to Angola had "merely reported on what had been conveyed to them by the {Angolan} authorities and commanders. The South African government rejects the version of the events as conveyed to the secretary general's representatives."