South African commandos killed at least 13 persons today in a predawn attack in the Botswanan capital of Gaborone, claiming that houses there were being used as bases by insurgents of the underground African National Congress.

Three women, a 5-year-old child and a Sudanese refugee with Dutch citizenship were among the dead. Six persons, including a 10-year-old child and the Sudanese refugee's wife, also Dutch, were injured.

The young wife of a Botswanan government social worker also was reported to have died together with her brother, who was visiting from South Africa.

Botswana's president, Quett K.J. Masire, said he feared the raiders also may have abducted some people and taken them across the border into South Africa. Describing the raid as "an act of brutality and violence," Masire said he saw it as the fulfillment of threats South Africa had made in February to invade his country because of its refusal to sign a mutual nonaggression treaty similar to one that South Africa signed with Mozambique last year.

But the chief of the South African Army, Gen. Constand Viljoen, said the raid was launched "with the greatest sense of responsibility" because ANC insurgents were using the Botswanan capital as a "control center" for sabotage inside South Africa.

He said 36 attacks had been planned from there since last August, resulting in six deaths.

Last Wednesday's assassination attempt on a newly appointed Colored, or mixed-race, deputy minister in the South African Cabinet, Luwellyn Landers, and a Colored member of Parliament, Fred Peters, also had been planned from Gaborone, Viljoen said. This, he said, had been "the last straw" that brought the reprisal raid.

The raid, the fourth of its kind that South Africa has launched against its black-ruled neighbors in recent years, but the first against Botswana, drew protests from western and other governments.

The Dutch Foreign Office delivered a sternly worded protest to the South African ambassador in The Hague on the attack on its citizens, Achmed and Roelfien Geer. In London, British Foreign Secretary Geoffrey Howe summoned South Africa's ambassador to protest what he called a "blatant violation of the sovereignty of a fellow Commonwealth country."

Reporters in Gaborone, just eight miles from the South African border, described grim scenes in the residential areas where the attacks took place just before 2 a.m., with several houses demolished by powerful explosives and shredded belongings scattered over a wide area.

One reporter said he saw police officers picking through the rubble of one wrecked house collecting fragments of disintegrated bodies and placing them in a metal coffin while shocked neighbors looked on.

"People here are stunned," a reporter for a local newspaper said. "Most of those killed were South African refugees who had been here a long time. Gaborone is a small town, and we all knew them."

A security police officer, Brig. Herman Stadler, who addressed a news conference along with Gen. Viljoen in Pretoria today, said ANC insurgents began using Botswana as their main infiltration route after Mozambique was closed to them by the signing of the mutual nonaggression treaty, called the Nkomati accord, in March 1984.

Stadler said that although the organization was only allowed a political office in Gaborone, ANC trainees came into Botswana as tourists and underwent "crash courses" in sabotage.

Viljoen said that South Africa had intelligence information that this week's assassination attempts were the first of a series of attacks planned for this month against "moderate" nonwhite leaders.

"We may have caught them just in time," Viljoen said.

According to Botswanan sources, the South African commandos entered Botswana in buses.

In a well-synchronized operation, they took up positions near 10 houses in different parts of the capital. The attacks, with machine guns, grenades and mortars, were then launched simultaneously.

Radio Botswana said the raiders used bullhorns to warn local inhabitants to stay indoors and turn off their lights during the attack.

The offices of Solidarity News Service, a news agency that often circulates critical reports about South Africa, were also attacked, and its equipment was destroyed. Viljoen charged that the agency was an ANC information center.

In a statement from Cape Town, Foreign Minister Roelof F. (Pik) Botha said that South Africa had "no alternative" but to protect itself against a growing number of insurgent attacks from Botswana.

Botha said he had met nine times since August with Botswanan representatives to warn them that South Africa would be compelled to take action if they did not curtail ANC activities in their country.