An elderly African leader threatened with gangrene and a possible amputation has been in jail here for the past 2 1/2 years while the slowest trial in South African history has proceeded against him.

Oscar Mpetha is 72 and suffers from diabetic complications that have affected his circulatory system, threatening to cause a gangrenous deterioration in his legs. He has had two operations while the case has dragged on, including a toe amputation. Now doctors have warned that his left leg may have to be amputated.

Yet the state has refused to allow him bail and Mpetha has had to remain in jail throughout the lengthy trial.

His health is so bad that the judge, Denys Williamson, has excused him from court appearances for long periods during which the case went ahead without him. But Mpetha is charged under the security laws which means the judge has no jurisdiction over bail.

That is up to the state-employed attorney general, Neels Rossouw, who must act on the advice of the security police. Rossouw has refused seven requests for bail from defense lawyers.

Mpetha, a veteran civic and trade union leader, is charged with terrorism and murder. He is accused of inciting Africans to violence at meetings in a black township near Cape Town three years ago, causing them to riot and stone two white motorists to death.

Mpetha has denied attending the meetings or being anywhere near the scene of the stonings. Only three of more than 80 state witnesses have implicated him at all, and the judge recommended that one of those be charged with perjury.

Defense lawyers considered the evidence against him so thin that they applied for his discharge at the close of the state case last August, arguing that he had no case to answer.

But Williamson refused the application, noting that one of Mpetha's 18 fellow defendants, Phillip Nyongqwana, had made a statement to the police implicating Mpetha and that he had still to give evidence in his own defense. So Mpetha stayed in jail.

Nyongqwana, a former psychiatric patient described by a state doctor as emotionally unstable, finally testified last Thursday. He said his statement to the police was false and that he had made it because he was afraid of them. Mpetha was not implicated, he said.

For the old civic leader that still did not mean freedom. He must wait now for the case to run its full course and for judgment to be given, which lawyers say could be another five months.

Mpetha's troubles began during an African bus boycott in August 1980. As sympathetic motorists gave the walking Africans lifts, the police made road checks, ostensibly looking for unlicensed taxis. This inflamed emotions and rioting broke out. Young Africans set up roadblocks, stopped cars and stoned two white men to death.

A reporter from the Cape Times sought comment from Mpetha, the most respected African leader in the area. He blamed the police for provoking the unrest. The morning after his statement was published Mpetha was detained by the security police.

For four months there was no explanation, while the Cape Times asked in editorials whether he was being punished for speaking his mind.

Then Mpetha appeared with 18 young Africans charged with terrorism and murder. He was accused of planning and inciting the trouble.

The delays began immediately. There were lengthy arguments over points of law. Illnesses, accidents and the death of an African interpreter caused a series of adjournments. For the convenience of various lawyers the court decided not to sit for more than one whole day and two half days each week, meaning it averages 10 sitting hours a week instead of the normal 16.

Mpetha has to be carried into the oak-paneled courthouse each day. His left leg is heavily bandaged and he wears a slipper on his right foot, which is also becoming diseased.

He sits in a corner of the rectangular prisoner's dock in a navy blue suit and tie. Beside him are the young men he is supposed to have incited to riot, wearing bright T-shirts and medallions with slogans such as "black and proud," and "students against oppression."

A reporter manages to exchange a few words with him before a policeman steps forward to stop the conversation. It is not allowed. The old man has managed to say only that he is lonely and in pain: that he has spent most of the 2 1/2 years isolated from the others in the prison hospital.

He does not seem to be bitter. When he gave evidence in September prosecutor Johan Slabbert asked him: "Are you against the whites, the Boere Afrikaners , do you hate them?"

"No," Mpetha replied, "I am not against the whites. We must accept them as people of this land."