President Pieter W. Botha, anticipating a confrontation when 1.7 million black youngsters return to South Africa's segregated school system Monday, invoked the government's sweeping emergency decree today to empower education officials to bar or expel any student from school without a hearing or explanation.

The move came as South Africa braced for widespread protests from students objecting to these and other school restrictions and from black trade unionists who have marked Monday for strikes and slowdowns to demand the release of the estimated 250 labor officials detained under the emergency, now in its second month.

Meanwhile, there were unconfirmed reports from Soweto that between nine and 12 blacks have died in fighting between antiapartheid militants and migrant workers residing at a nearby hostel. The government's Bureau for Information, the only source of authorized news on the civil unrest that has claimed more than 2,000 lives here, reported only two new deaths in other incidents.

Botha's proclamation adds new strength to the large-scale security measures at the country's 7,000 black schools that the government announced last week. Security guards will be posted at all schools and pupils will be forced to wear identity cards, in an attempt to keep out "outside agitators."

The new regulations also empower education officials to place students in any class they deem proper. Students who refuse to accept such placements "shall be deemed to have left the school voluntarily" and will have to leave school grounds.

Additional police orders in a number of black urban areas restrict students' movements on school grounds, bar them from any unsupervised or political activities and prohibit them from being outdoors during school hours.

The restrictions are designed to prevent a repetition of widespread unrest over the past two years when students used the schools to organize political protests and boycotts. Police, who delayed the reopening of schools for two weeks, see them as a critical battleground in their attempt to quell the country's large antiapartheid movement.

The state Department of Education and Training had sought last year to negotiate with black parents and student groups to end school boycotts and return at least a modicum of normality to the country's troubled schools. But the new decrees and restrictions were drawn up without consulting black groups and have brought heated denunciations.

The National Education Crisis Committee, the premier black education group, denounced the measures as "a clear recipe for confrontation" between students and police.

Similarly, there were reports today that leaders of the Transvaal Students' Congress had voted for a two-week walkout to protest the new measures. The congress, which is affiliated with the United Democratic Front, the country's leading antiapartheid coalition, last week accused the government of turning the schools into "Nazi camps."

The Congress of South African Trade Unions, the country's largest black labor federation, today confirmed its plans for a national "day of action" Monday to protest the emergency and the union detentions. In the politically active townships around Johannesburg, union officials said, they are planning for workers to stay away from their jobs, while in other areas -- including South Africa's key gold and diamond mines -- they are asking workers to engage in slowdowns and sit-ins once on the job.

The fighting in Soweto began nearly a week ago when some residents of the Mzimhlope hostel there began raiding houses in the Meadowlands area looking for young militants, known as "comrades," residents said. Dozens of houses have since been burned down and a number of people have been killed in gun battles between the two groups.

The hostel dwellers are mostly Zulus professing loyalty to Chief Gatsha Buthelezi, whose followers have been locked in an increasingly violent power struggle with UDF supporters. Residents compared the battles to those of the 1976 Soweto uprising when residents of the same hostel went into Soweto to attack student leaders of an abortive uprising against the white government.

Then, as today, the hostel dwellers were believed to have the tacit support of local police.

The Bureau for Information has confirmed two deaths in the violence, but has issued no further reports on the fighting there since yesterday morning.