The new military leaders of Uganda, moving today to secure their position a day after ousting the government of President Milton Obote, scrapped the constitution, dissolved parliament, halted foreign exchange trading and sealed the country's borders.

Speaking on Radio Uganda, the coup's apparent mastermind, Brig. Basilio Olara Okello, announced his arrival into the capital and urged residents to remain indoors.

Similar orders were broadcast throughout the afternoon after a 24-hour looting spree by soldiers and civilians that ravaged much of downtown Kampala. Four bodies with gunshot wounds were found this morning on a street near the city's central market, according to reports reaching here. Looting and car theft also spread today to the city's wealthy suburbs.

"People are breaking into private homes and commandeering cars from private compounds," said Hillegonda J. Goris, resident representative of the World Bank, in a telephone interview. She said looting had spread to the affluent Tank Hill and Kolola Hill sections of the city, where diplomats and senior Ugandan government officials have homes.

"We are all staying home. We have heard gunfire all day. It sounds like the normal fireworks that accompany looting. The soldiers are trigger-happy now," Goris said in the early afternoon.

Okello, who led about 30 Army trucks into the city yesterday morning and today was introduced on Radio Uganda as the "leader," said on the radio that he ousted Obote in the name of "unity."

"I have arrived here in Kampala," Okello said. "Stay calm. Stay at home. We took the step because of unity."

The new military leadership has made friendly overtures to Uganda's most powerful rebel group, which has been active in western Uganda for five years. The leader of the National Resistance Army, Yoweri Museveni, who is in Stockholm, was quoted yesterday as saying he would be willing to cooperate with the new leadership.

One indication of that cooperation was evident from broadcasts over Radio Uganda. An officer identified only as Col. Maluru, who deserted the Ugandan Army in December 1983 to join the National Resistance Army, was today's radio spokesman for the new military government.

In a series of announcements on the radio, which yesterday played rock tunes but today switched to martial music, Maluru said the military government did "not seize power for its own sake" and that it would hold elections. He did not say when elections would be held. The spokesman also told foreign governments "not to intervene in this affair."

Former president Idi Amin said Sunday that he had ordered his followers to end their rebellion against the government in Kampala and to support the coup leaders who toppled Obote.

"I have been in contact with my boys and, this morning, I ordered them to stop fighting the government and support the coup," Amin told Reuter by telephone from the Saudi Arabian city of Jeddah, where he lives in exile.

In Uganda, all senior ministers and police officials were ordered to report to the officers' mess in Kampala. Looters repeatedly were warned: "Looting and shop-breaking have been declared illegal . . . . Action will be taken against anyone found looting."

Obote's whereabouts remained unclear tonight. Newspapers in Kenya had reported today that Obote and an entourage of about 20 senior government officials crossed the Ugandan border into neighboring Kenya yesterday morning.

There were unconfirmed reports today that Obote, whose wife is staying under guard in the Ugandan diplomatic mission in Nairobi, remains in western Kenya in a Kenyan government residence. A western diplomat, however, said today that a top Kenyan government official denied that Obote was still in the country.

Obote, 59, now has been turned out of office twice by military coups. The first was led in 1971 by Amin, who became infamous for human rights abuses before being driven out of Uganda by Tanzanian troops and Ugandan rebels.

Throughout last night and into this morning, there was artillery fire in Kampala, along with frequent explosions of rifle-propelled grenades, said Ann Howard, an American who lives near the center of the city, in a telephone interview. Her husband, Steadman Howard, a public affairs officer of the United States Information Service, said today that the inability to travel made it impossible to assess damage in the city.

"We have been hunkered down, and nobody has been moving. Things have settled down to a dull roar. The situation is unsettled and fairly risky," Steadman Howard said. There are about 100 U.S. citizens in Kampala, with another 150 in the Ugandan countryside. U.S. officials in Kampala said today that there were no reports of them having been injured in the coup.

In Washington, State Department spokesman Joe Reap said, "We've made preliminary contact with the military authorities in control of Kampala to seek protection for our personnel . . . . We are urging private Americans in Uganda to remain in their residences and to keep in constant touch with the embassy," The Associated Press reported.

Okello, the apparent new leader of Uganda, is a career military man who fled Uganda in 1971 when Amin came to power and remained in Tanzania until 1979. He then returned to the country with troops that had a hand in ousting Amin.

Okello was a commander in the Ugandan Army when Obote returned to power in 1980 in a disputed election.

After repeated warnings against looters, Kampala quieted down this afternoon, according to residents interviewed by telephone.

A few pedestrians returned to downtown streets, which were littered with discarded cardboard boxes, the detritus of looters who had hauled off radios and assorted electronic gadgets.

"It is not so serious as I expected," said Roman Catholic Cardinal Emmanuel Nsubuga, an outspoken critic of the Obote government, in a telephone interview.

He said there was little panic in the city and little of the wild celebrating that occurred in Kampala when Idi Amin seized power or when he was ousted.

"People, I think, have learned a lesson," the cardinal said.