The government closed indefinitely half of its public schools for students of mixed race in the western Cape Province region today because of unrest in townships there that have become South Africa's latest focus of political violence.

A senior government finance official, meanwhile, acknowledged that the country's recently announced four-month freeze on foreign debt repayments had damaged investor confidence seriously, but hinted that it might be necessary to extend the freeze beyond the end of the year. Details, Page A16.

Coupled with the school closings, the freeze statement was further evidence that South Africa's white rulers are prepared for a long political and economic siege in which whatever measures they consider necessary to stifle unrest will be taken in spite of possible international consequences.

Schools have been a major focus of clashes between youths of mixed race and police in western Cape Province since the police arrested the Rev. Allan Boesak, the country's most prominent mixed-race antiapartheid figure, and crushed demonstrations in the townships near Cape Town last week. At least 30 persons have been killed in the violence and more than 150 wounded, setting off widespread allegations of police brutality and bringing the country's death toll during the past year of unrest to about 675.

In announcing the closings, which will affect 360,000 elementary and high school students, Carter Ebrahim, the government's minister for mixed-race, or Colored, education, said school authorities could no longer guarantee the youngsters' safety. He charged that "many schools were no longer performing an educational function but have become bases for planning unrest activities."

Ebrahim said that 454 of 904 schools have been shut down, including all of the schools in the townships of Mitchell's Plain and Athlone near Cape Town. He said that he could not say with certainty when the closing order would be lifted, but he added, "Hopefully, it would last only a few weeks."

Much of the worst violence in recent days has been in Mitchell's Plain and Athlone, with angry students setting up dozens of burning barricades and attacking police and private cars with rocks and gasoline bombs. Police have fired rubber bullets, tear gas and, in some instances, live ammunition at the rioters.

There was more school violence today outside Durban, where police fired rubber bullets, shotgun pellets and tear gas and used plastic whips against black students at Lamontville High School.

The school's principal, Phillip Mozobe, said police fired on the school, shattering windows, after being stoned by some people outside. The police then entered the school and beat students with whips. Several students jumped from windows to escape, and five were hospitalized, according to Mozobe.

He said the police regrouped outside and were starting to reenter when he blocked their way, telling them to kill him or leave. They then departed.

A police spokesman confirmed that birdshot, rubber bullets, tear gas and whips had been used "to disperse a crowd after police vehicles had been stoned."

Law and Order Minister Louis le Grange said today that "further steps" were planned to end the unrest, although he would not specify them. "We cannot allow it to continue uncontrolled," le Grange told reporters after visiting the Cape Town area. "We cannot allow . . . criminals and fomenters of unrest to fill the streets creating trouble."

The United Democratic Front, one of the country's foremost movements opposing the racial segregation system of apartheid, announced it believed that the government planned to ban the movement soon. Such a move, the statement said, "would be tantamount to declaring war on our people."

Three more front leaders were arrested outside Cape Town today, bringing to at least 40 the number held during the past two weeks. But the townships around the city were mostly quiet, with police reporting only scattered violence.

There are plans to bury 12 victims of violence Saturday, 10 of them under age 20, including a 2-month-old black girl.

Boesak, through his wife, issued a call to students for restraint. Dorothy Boesak said her husband, whom she visited for an hour Thursday, had urged supporters "to remain strong and not give up hope."

"He would not want to see the loss of any more lives and urges the students to restrain themselves in order not to be exposed to further violence," she said.

Boesak, arrested after he attempted to organize a march to demand the release from jail of the black nationalist leader Nelson Mandela, is being held without charge or access to a lawyer under South Africa's sweeping internal security act. Dorothy Boesak said he had been kept in solitary confinement and given only a Bible to read, though he had received visits from a magistrate and a priest. She said he was in good health and spirits.

Mandela, 67, South Africa's most famous prisoner, was taken from his cell to a local hospital for urological tests and then returned, officials said. The announcement, which gave no indication of Mandela's state of health, set off fears that the African National Congress leader may die in prison, where he is serving a life sentence for sabotage. His death undoubtedly would trigger a harsh round of violence among youthful followers who have campaigned for his release.

Mandela's lawyer said he would make an urgent court application Monday to have his client examined by a family physician. The lawyer, Ismail Ayob, said Mandela's wife, Winnie, was "frantic with worry."

The police said 113 more people were detained in the past week under the government's state of emergency, bringing to 2,527 the number arrested since the July 21 decree. A total of 866 remain in jail.

Law and Order chief le Grange dismissed as "childish" a call from parliamentary opposition leader Frederik van Zyl Slabbert for their release. "We have just detained these people who are involved in the unrest situation, and now Dr. Slabbert wants them to be released," he said. "It is clear they would immediately resume their activities."

Two more black youths, a 14-year-old girl and a boy whose age was not reported, were killed by police last night in Mdantsane, a sprawling black township outside East London in the black "homeland" of Ciskei, the police said.