The crumbling army of Ugandan President Idi Amin today virtually abandoned Kampala, turning over the defense of the beleaguered capital to Libyan forces, according to diplomats and residents of the capital.

Tanzania, which is backing Ugandan rebels, charged that Libya broadened the East African conflict by bombing a town in northern Tanzania.

Diplomats in Kampala said the besieged and shelled Ugandan capital was being defended by Libyan troops, who were hurriedly airlifted into the city, and could fall within hours.

There are increasing signs that Amin's army has collapsed. Large sections of the Ugandan Army are said to have rebelled and residents in the capital, interviewed by telephone, reported that no Ugandan soldiers could be seen in Kampala.

Meanwhile, Amin defiantly announced that his forces were launching a "general attack" against the invaders that would "surprise the world."

There were, however, conflicting reports from within the embattled country. There are no Western journalists in Uganda.

Evidence of last-ditch Lybyan aid for the beleaguered Amin government, in keeping with Col. Muammar Qaddafi's pledge to "fully" back the Ugandan dictator, was provided by reports of:

An air raid on the Tanzanian air base town of Mwanza yesterday, which missed its apparent target, a fuel storage depot.

Unloading of 50 truckloads of Libyan arms in the Kenyan port of Mombasa.

The airlift of perhaps 900 fresh Libyan troops into a northern Uganda air base.

At midday, Kampala residents reported seeing paratroopers in the capital, apparently Libyan or Ugandan soldiers, although they were too far away for accurate identification.

Refugees and residents alike told of increasing signs in Kampala of the Ugandan Army's disintegration-panicking troops looting, throwing away weapons and uniforms, and commandeering civilian cars at gunpoint to flee in.

The newly formed Uganda National Liberation Front announced that Amin's minister of state for defense, Brig. Emilien Mondo had changed sides and that he and his troops were now fighting alongside the invaders at the capital's outskirts.

The coalition of Ugandan exiles also claimed dissident troops had seized barracks in the important provincial centers of Jinja, Tororo and Masinde.

Refugees fleeing the increasingly deserted capital by the thousands told reporters that the invading forces had captured the village of Busega, only four miles from Kampala.

Kampala residents barricaded themselves in their homes as sporadic artillery fire was exchanged between invaders and Libyan gunners ensconced on various hills around the capital.

Tanzanian artillery razed one of Amin's hilltop residences, known as the "command post," and badly damaged the Mengo Palace, now the barracks for the Malire Brigade.

Symptomatic of the new mood of confidence among middle-class Ugandans was the fact that many not only preferred to stay and wait for the takeover by anti-Amin forces but also, for the first time in years, are willing to speak freely on the telephone.

Offices were deserted, however, and shells crashed into the city center, killing several people only 50 yards from the French Embassy. Overall casualties were not immediately known, but refugees spoke of trucks carrying Ugandan and Libyan corpses.

Indicative of the confusion was the arrival here of the Ugandan airline plane from Entebbe Airport, which officially was closed Sunday at Amin's orders.

Passengers reported that the Kampala-Entebbe road, which the invaders claim is mostly in their hands, is still under effective government control.

The only signs of normal activity in Kampala were the programs and news bulletins of Radio Uganda, which broadcast communiques from a Ugandan military spokesman, a favorite code word for Amin himself.

His whereabouts were not known, but he was said to have dressed three other bulky Ugandan lookalikes in field marshal uniforms to confuse would-be assassins, and perhaps as a result, Amin was variously reported in Kampala, Mbale in the east and in his northern home territory of Arua.

Despite repeated Ugandan broadcasts aimed at keeping both Ugandans and foreigners in the capital, the United Nations and most embassies were either evacuating nonessential staff or preparing to do so because of the shelling.

Thousands of Ugandans, and hundreds of foreigners, drove out to the Kenyan border without major difficulty, although some Westerners reported that armed men had robbed them of their money.

Diplomatic sources said the Libyan airlift continued, with troops landing at Nakasongola air base, about 90 miles north of Kampala.

Diplomats said they believed that a Soviet-made Libyan Tupolev 22 bomber based at that Israeli-built installation yesterday raided the Tanzanian Air Force town of Mwanza on the shores of Lake Victoria.

Tanzanian and Ugandan exile sources said the only casualties were one slightly wounded man and six gazelles killed when bombs, apparently meant for oil storage tanks, fell on a nearby animal sanctuary.

Meanwhile, two Libyan airline Boeing 727s were seen at the Nairobi airport, where they do not normally stop. Diplomats surmissed that they were ferrying badly needed aviation fuel to Nakasongola air base, which the Libyans may use to bom Kampala if the capital eventually does fall. The diplomats said food and material have been stockpiled at Nakasongola for several weeks.

Informed sources said Kenya, which does a brisk business transporting goods in and out of landlocked Uganda, has been quietly supporting Amin. Intelligence sources said Kenya would prefer a continuation of Amin's rule to a successor ideologically sympathetic to socialist Tanzania.

The Ugandan National Liberation Front tonight appealed to the Kenyan government to prevent 50 trucks laden with Libyan-supplied arms from leaving the Indian Ocean port of Mombasa for embattled Ugandan forces.

The Front said it was making its appeal public because "other channels had not worked," an apparent allusion to Kenya's refusal to stop the trucks from passing through its territory.