Mayor Marion Barry arrived here this afternoon on the last stop of his five nation African tour and was welcomed by dancers and musicans in a greeting generally reserved for visiting heads of state.

The mayor, whose superlatives have esclated since his first stop in Senegal two weeks ago, said he was "ecstatic."

The sound of drums could be heard as the Tanzanian Airways plane, carrying Barry's party from Zambia, taxied to a stop. The welcoming crowd spread out over a large area of the runway.

Barry, who had remarked yesterday that his receptions in Africa have been just short of state visits and have lacked only military review, got even that, after a fashion, today.

Green-uniformed youths, members of the Young Pioneers, stood in formation with mock swords drawn for the mayor's inspection. He was led among the cadets who are the youth training section of Tanzania's official political party,the Revolutionary Party of President Julus zK. Nyerere's socialist government.

A uniformed police band was even on hand to play at his arrival, competing for the ear with the Arican druns.

It was, confided one U.S. official in the greeting party, a much larger reception than Los Angeles Mayor Tom Bradley received when the visited here in January.

In all, it took nearly half an hour for Barry to make his way to the VIP lounge from the plane. All the time, children dressed in the traditional dancer's attire of feathers and dyed sisal strands and with faces painted white, danced barefoot on the hot pavement.

It wasn't all smooth sledding for the beaming mayor, however. He had to answer, for the first time, questions raised by the local press about the presence in his pary of Carter H. Dove, vice president of Riggs National Bank. The bank has been criticized for lending to South African businesses.

"The countries we have visited have welcomed Mr. Dove," Barry said. He said he invited many people on the trip. Others declined the offer, but Dove accepted and agreed to pay his own way. Barry, whose trip is sponsored by the International Communications Agency, said that discussing Dove rather than his views of the Africa tour was to permit "the sideshow [to run] away with the main event."

The mayor, who will stay three nights in Tanzania, is scheduled to meet on Saturday with Nyerere. It will be Barry's fifth visit with a head of state in five countries.

Earlier today, in Lusaka, Zambia President Kenneth Kaunda urged Barry to live up to his reputation as a "militant" by organizing black Americans must "get organized and influence events in favor of black people who are suffering."

The president told Barry that his visit here was a "very important milestone" but also with "significance far beyond your mayoral responsibilities."

The mayor said Kaunda's speech was 'one of the most moving Ive ever heard."

Arriving in Zambia on an overnight stop between Kenya and Tanzania, Barry received an elaborate welcome when Lusaka Mayor Simon Mwewa and half of the 30 city council members lined up on the runway to meet the mayor at dusk.

Far from feeling shortchanged by Barry's brief stopover, the Zambians seemed grateful for his visit.

At a final cermony before his departure for Tanzania, the mayor and his party were entertained in the city council chambers with words of praise and two renditions of the National Anthem. The mayor was given a gleaming copper blaque engraved with the gull maned figure of a lion.

Barry assured the Zambians that, although he is not a part of the Federal government, he personally would do all he could to support the freedome struggles. "We are going to create the lobby [for Africa in Washington] and you are going to begin to see the effects," the mayor pledged. CAPTION: Picture, Mayor Marion Barry inspects troop of Young Pioneers who gathered to greet him at Tanzanian airport. AP