Invading Ugandan troops backed by heavy artillery and tanks pushed about 20 miles inside Tanzania yesterday despite sharp resistance by Tanzanian forces, the government said.

The fighting follows a week of claims from Ugandan President Idi Amin that his neighboring East African country is being invaded by Tanzania - claims that were greeted with skepticism because of Amin's reputation for broadcasting fanciful reports on his national radio.

President Julius Nyerere's charges that Ugandan troops were doing the invading were given more credibility, however, and diplomats said Amin could have sent forces across the border to divert attention from serious unrest within some units of his army.

Reports from the battle area, more than 600 miles northwest of Dar es Salaam, were sketchy but a Tanzanian communique last night said tanks and artillery were being used and the Ugandan troops had reached the town of Kyaka, 20 miles south of the border, since launching the invasion Monday.

Whatever the course of the fighting, the conflict clearly was an embarrassment for black African states attempting to bring unified pressure against the white minority governments of Rhodesia and South Africa.

Tanzania and Uganda have been at loggerheads since former Ugandan President Milton Obote took up residence in Tanzania after Amin overthrew him in 1971. Obote has assumed the leadership of about 20,000 Ugandan refugees here who have fled the brutal tactics of Amin's capricious dictatorship.

Some of the refugees did mount an invasion of Uganda in 1972, but were easily routed by Amin's troops. Since then, Amin has reported about half a dozen other "invasions," always at times when he needed to rouse domestic support against foreigners criticizing his human rights violations.

Tanzanian officials viewed the fighting with strong concern. Presidential and Defense Ministry officials were up throughout Monday night as the fragmentary reports came in.

A government communique said yesterday morning that "all necessary measures are being taken to meet the agression." But there was no official word on casualties.

Reports from missionaries in the Ugandan invasion began over the weekend. Refugees were reported to be fleeing from Bukoba, a town just below the Ugandan border, to Mwanza, on the other side of Lake Victoria.

The refugees told of heavy casualties when Amin's warplanes bombed the Bukoba area last week. Various reports said a clinic, village and bridge were hit.

Embassies here were trying to contact their nationals in the area, but found great difficulty because telephones were out of order. An American Embassy spokesman said 16 Americans are in the vicinity of the fighting. 11 missionaries and five members of a Brown University archeological project.

The embassy official said the United States has "no contingency plan" to evacuate the Americans and U.S. diplomats are still trying to assess the seriousness of the situation.

However, a number of other foreigners have either fled or been evacuated from the area. Dutch, Indians and a Canadian working on a sugar estate near Bukoba were evacuated at the request of the Tanzania military. Fifteen Swedish missionaries have taken refuge at a mission some distance from the fighting.

Confusion surrounded the invasion and the earlier Ugandan claims of a Tanzanian incursion. Ugandan exiles and Tanzanian officials said there has been serious unrest within Amin's army in recent weeks. The Ugandan dictator reportedly has brought in new recruits from southern Sudan to "eliminate" his army dissidents.

In addition, the Ugandan economy is said to be in a state of disarray. The United States has imposed a trade embargo on Uganda because of charges that at least 50,000 persons have been arbitrarily killed since Amin came to power. Although Uganda's main crop, coffee, is believed to be unaffected by the embargo, Amin warned in a broadcast Oct. 12 that he was about to take "very drastic" action against the 200 Americans in Uganda to retaliate. As far as is known, nothing ever came of the threat.

Sources in Dar es Salaam speculated that Amin could be trying to provoke Tanzania into combat, or give the impression that a border war is going on, in hopes of getting much needed cash assistance from conservative Arab countries pleased by his expressions of Moslem solidarity.

Uganda's 12 million inhabitants are only 10 percent Moslem but Amin himself is assertively Moslem and has renounced earlier ties to Israel in favor of Palestinian guerrilla movements.

Amin's broadcasts earlier this week charged that the Tanzanian troops said to be invading Uganda were aided by Cuban advisers. Nyerere denied the charge and yesterday's communique called it "a blatant lie." Western diplomats here and in other African capitals said as far as they knew, there are no Cuban troops in Tanzania.