Guerrillas assisted by Zambian army troops rained heavy artillery and rocket fire on two towns in Namibia (Southwest Africa) early yesterday, South African military spokesmen said. Nine South African soldiers were killed and 10 wounded, the spokesmen added.

It was the highest death toll for South African military forces in any single engagement in the 12-year-old independence war being waged by the Southwest African people's Organization against South African troops stationed in the territory controlled by Pretoria.

Zambia charged June 14 that South Africa was massing troops and aircraft along the border in the Capriri Strip in preparation for an attack on Zambian territory.

Western diplomatic sources in Lusaka expressed concern at the time that South Africa might be planning another preemptive strike at guerrilla forces of SWAPO like the one May 4 that struck deep into Angola.

Zambian officials denied complicity in yesterday's two-hour attack on the town of Katima Mulilo and Wenela in the Caprivi strip, an area of Namibia which borders Zambia. Zambian Foreign Minister Siteke Mwale told the Associated Press that "while determined to defend her sovereignty and territorial integrity, Zambia had no intention of attacking South Africa."

Mwale reaffirmed Zambia's full support of a United Nations' plan for a peaceful transition to independence in Namibia that is to go into operation next month. He said he called in representatives of five Western countries, the United States, Canada. Britain, West Germany and France, yesterday for discussion. The five states were active in bringing about agreement on the U.N. plan.

Meanwhile South African Defense Minister P.W. Botha told a group of government supporters that "South Africa took appropriate steps after this attack," but he did not say what those steps were.

he large number of casualties suffered by South African troops resulted even though South African military authorities said they were aware of the preparations for the attack since early this month. The commander of South African military forces in Namibia, Maj. Gen. Jan Geldenheys said he had informed the U.N. military commander Maj. Gen. Hannes Philip of these preparations but he did not indicate what the response of the U.N. official had been.

Philip is in Namibia as part of a U.N. task force preparing for the launching of the U.N. plan for a peaceful transition to independence in the country. The first phase of that plan involves a cease-fire in the war between SWAPO and South Africa.

Although South Africa has called for a cease fire now that the independence plan has been accepted by both South Africa and SWAPO, SWAPO has refused to agree until formal implementation of the plan next month.

The implication of this latest incident for the U.N. peace plan is not immediately known and much will depend on the South African response to the attack. Last May 4 South African airborne troops inflicted a devastating attack on one of SWAPO's major guerrilla training centers in southern Angola, killing some 1,200 people, according to some reports.

This latest SWAPO attack indicates that the guerrilla movement is recovering from that South African action.

The attack came only a few hours after the head of the U.N. task force, Martti Ahtisaari, left Namibia to report back to U. Nations Secretary General Kurt Waldheim. Ahtissari's report will contain his suggestions on the best way to implement the United Nations independence plan.

Former Texas Gov. John. Connally, who is visiting South Africa and Namibia, was to have visited Katima Mulilo yesterday, but his itinerary was changed because of the attack, a South African military communique said.