Libyan leader Muammar Qaddafi threatened today to intervene fully" to defend the increasingly beleaguered regime of Idi Amin unless Tanzanian troops backing an anti-Amin revolt pull out Uganda within 24 hours, the Tanzanian leader announced.

President Julius Nyerere, in a speech to the nation, said the ultimatum, received this morning via the Libyan ambassador, could mean hostilities will become "much more serious." He called on Tanzanians to "tighten their belts even more" because if Libya enters the war, he said, fighting is certain to "spill over into Tanzania."

It was impossible to predict whether Qaddafi's reported ultimatum constitued more than bellicose bluster for which he has become known in his role as spokesman for pan-Arab, Islamic and often anti-Western causes. There were no reports from Libya on any announcement concerning the war in Uganda.

Observers point out, however, that, Amin and Qaddaffi together are an unpredictable mix, and that Libya already is reported to have dispatched troops, tanks and warplanes to bolster the Ugandan dictator.

There has been no confirmation of any Libyans involved in battles. But among the planes are said to be Soviet-built TU22 supersonic bombers, which for the first time would give Amin the theoretical capability of bombing Dar es Salaam.

About 4,000 to 5,000 Tanzanian troops are estimated to be in Uganda, providing indispenable backing for Ugandan exiles and locally recruited rebels in their four-month-old struggle to topple the brutal eight-year-old Amin government. Nyerere's participation in the hostilities has imposed a considerable economic burden on the Tanzanian public and today's speech seemed calculated to rouse popular support for the war effort.

Nyerere said the message from Qaddafi pledged to guarantee that Amin would not again attactk Tanzania-as he was reported to have done last October-if the Tanzanian troops withdraw from Uganda. But the Tanzanian leader rejected this suggestion, saying Amin is "unpredicatable" and that Uganda is not a colony" of Libya.

Radio Uganda, meanwhile, claimed that Amin's forces had reopened the road from Entebbe to the Ugandan capital of Kampala in heavy fighting during which anti-Amin mercenaries were captured. This followed a widely disbelieved radio claim yesterday that Amin had been stranded at his headquarters in Entebbe by a Tanzanian force that had cut the road and surrounded him with tanks.

Tanzanians said then that their forces were not even inside Entebbe.

Today's claim appeared to be another of the frequently fanciful battle reports that have been broadcast by Amin's radio as the Tranzanian-led rebels continue their advances.

Yusuf Lule, chairman of the Ugandan National Libertion Front's executive council, said today he will establish a government in rebel-held areas "as soon as is pratical." Other sources in the front, which was announced yesterday in the northern Tanzanian town of Moshi, said this could come within a few days.

Lule said about 3 million persons are in sections of Uganda "liberated" by anti-Amin rebels and their Tanzanian patrons over the last few months. These areas include Masaka, Ankhole and Kigezi, he said.

These claims, like most of the battle reports, could not be verified. Foreign correspondents have not been allowed access to the fighting.

The Ugandan radio reported today that Tanzanian troops captured the town of Mityana, 40 miles west of Kampala on the main road leading west.

Earlier intelligence reports had put tanzanian forces at Mpigi, 20 miles south of the capital. The capture of Mityana if true, thus would indicate that the tanzanians and rebels are attempting to surround Kampala.

Witnesses interviwed by telephone from Nairobi said Ugandan farmers were driving their cattle into Kampala to escape the fighting in surrounding towns, The Associated Press reported.