In an apparent attempt to obtain information on the hundreds of Soweto students who have fled to Botswana from South Africa, for Security Police here detained an Anglican dean from Botswana for 13 days.

The very Rev. Michael Molale, 45, Anglican dean of Gaborone, the capital of neighboring Botswana, was arrested July 26 as he was in transit to Umtata, Transkei, at Jan Smuts International Airport.

He was released yesterday from a Johannesburg jail where he was questioned daily on his work with the refugees.

His detention indicates the increasing concern among South African authorities about infiltration by urban guerrillas from Botswana, which, because of its economic dependence on South Africa, has refused to allow guerrilla bases on its territory.

Last Tuesday, however, South African police were involved in a gunfight with three alleged guerrillas at Zeerust, only 12 miles from the Botswana border. According to news paper reports, one guerilla was captured but two escaped. The captured man led police to an arms cache containing Russian rifles, according to the reports.

Molale said by telephone from Botswana last night that the police appeared worried about the refugees and wanted to know whether there were any "terrorist" camps there.

"Because I do work with the refugees, they suspected I would be a link with people inside South Africa," Molale said. Under Africa's anti-terrorism laws, any person, including non-South Africans, can be held in-communicado and indefinitely without charges for police questioning.

Molale said he was not mistreated, but that he could not change his clothes for 13 days. His family was informed of his arrest by a registered letter from the police, he said.

During his interrorgation, which he said was "not unpleasant, it was civilized" police also questioned him about others he had met abroad who are involved in relief work among the refugees. He said that the police had photostatic copies of letters he had written to people in Botswana while he was overseas.

"All international mail coming into Botswana is being picked up in South Africa," he said. "In this way, the south African police got a lot of information about people I'd met overseas."

A senior Botswana government source yesterday said official representations have been made to the South African government about the arrest of the dean who, although he is a Botswana, previously worked as a priest among blacks in Soweto and Sharpeville, in South Africa.

Before Molale's release, when reporters sought to confirm his detention, the commissioner of police, Gen. Michael Geldenhuys, would only say that "a person by that name" was being held, but he would not confirm it was the dean, according to a local newspaper report.