The war burning through the swamps of southern Sudan for the last two years had seemed remote from the streets of this desert capital. The overthrow of president Jafaar Nimeri in April seemed to open the way for peace. Talks with rebel leader John Garang appeared imminent.

Then, 10 days ago, the war started coming home to Khartoum. With the capital now shaken by rising violence, the future of the country that Washington has made central to its regional policy suddenly seems more precarious than at any time since Nimeri's fall.

The first conspicuous signs of new problems came when Moslem fundamentalists and military commanders began accusing Garang of bad faith in the peace process.

Garang has been battering the Army's forces in the field and he is steadfastly opposed to the kind of religious state demanded by the fundamentalists. Accommodation with him would be a defeat for hard-liners in both groups.

On Sept. 21, the Moslem Brotherhood and the Army staged an anti-Garang march that sparked violent clashes in the streets. As a result, further demonstrations were banned.

On Wednesday night, Army mutinies erupted in North Khartoum and Omdurman. For the next two days the police and troops were in the streets hunting down suspected conspirators. More than 160 arrests were announced. On Saturday night, a curfew was declared.

Many diplomatic sources had concluded on Thursday and Friday that the mutinies were isolated and largely spontaneous incidents.

Khartoum's political circles have been rife with coup rumors for several weeks. While few observers show much confidence that the government can last until elections promised in April 1986, most speculation about coup plots centered around ambitious northern Sudanese.

But when Prime Minister Gizzuli Daffa-Allah announced on television Saturday that the mutinies were part of an aborted coup, he said politicians from the Nuba mountains and southern Sudan were behind it.

Daffa-Allah said the plotters planned to murder members of the Transitional Military Council and the Council of Ministers who have tried jointly to run the country.

The leaders of the Moslem Brotherhood and the National Unionist Party were targeted as well, according to Daffa-Allah. Involvement of an unnamed foreign government was supposed to have been revealed by the confessions of those captured.

According to a statement by Defense Minister Osman Abdulla in Sunday's official Al Sahafa newspaper, among 162 alleged plotters arrested were a few Army officers and 50 soldiers. A southern Sudanese corporal named Samuel Bol Jok was being hunted and politician Philip Ghaboush was arrested.

The official statements did not say that Garang was behind the plot, but Ghaboush is an outspoken admirer of Garang. The unnamed foreign government is presumed to be Ethiopia, where Garang has his offices.

The southern Sudanese minority are mostly Christians or worshipers of traditional tribal gods, and oriented toward Africa.

The northern majority, who tend to be Moslems and see themselves as Arab, have a history of neglecting the southerners politically and exploiting them economically.

The resulting north-south tension has been the central source of conflict since before independence in 1956, usually with separatism the southern rebels' goal.

But in the 26 months since Col. Garang deserted the government's forces to found the Sudanese People's Liberation Army, he has transformed the regional uprising into a quest of control of the entire country.

Now, with extensive material backing from Soviet-allied Ethiopia, the American-educated and -trained Garang says he is fighting to shape a unified, socialist Sudan.

Fellow southerners who questioned Garang's authority were forced out or killed. At the same time, Garang set about building political links to the north.

Among Garang's top allies and officers is Yagoub Ismail, a Moslem Arab officer from Kordofan Province who reportedly has links to the northern political leader Sadiq Mahdi.

Mansour Khalid, an influential former foreign minister who resigned from the Nimeri government in 1978, now acts as the main voice for Garang's political front.

Garang reportedly has been courting Ahmed Direj, the popular former governor of Darfur Province, who some observers believe could command the loyalty of many western troops now serving in the Sudanese Army.

Garang is playing on discontent in the provinces, both north and south. As Sudanese faced starvation in 1984 and the first half of this year, it was more often Americans or Europeans than anyone from Khartoum who came to the rescue.

In recent months Garang has been reported recruiting Beja tribesmen in the northeast and building strong sympathy among the Nuba in the west. Both groups were hard hit by hunger. Both are famous as warriors.

He also appears to be gaining support in the Darfur provinces. A few local officials there said in interviews last week that they would be happy to see Garang made president.

In conventional military terms, Garang is still not positioned to take his fight north. His troops dominate large parts of two southern provinces. But they have had difficulties in the far south and show no significant strength north of Talodi, still 420 miles from the capital.

At the same time, survivors from the suffering provinces have migrated to the capital by the thousands in the past two years. The newcomers are fertile ground for political exploitation.