KAMPALA, Uganda (AP) _ Fighting escalated Thursday between the army and guerrillas seeking control of Masaka, the country's third-largest city. Masaka residents reported gunfire within city limits.

The government said Wednesday that its troops repulsed an attack by the rebel National Resistance Army on Masaka, 80 miles southwest of Kampala. But residents reached by telephone from Kampala said a major battle was raging late Thursday afternoon.

In neighboring Kenya, government and rebel delegates met twice for a total of about 30 minutes in their third round of peace talks.

''They agreed to meet again tomorrow morning,'' said an official who attended the sessions.

For a second day guerrilla leader Yoweri Museveni failed to show up and there was no word on his whereabouts. Museveni had headed the National Resistance Army delegation at the two previous rounds of talks.

Asked if the brevity of Thursday's meetings was an indication the talks were an at impasse, the official said, ''They are still in business.''

The official has been involved in all of the peace negotiations. He did not want to be identified by name or position because Kenyan President Daniel arap Moi, who has hosted the talks, has sworn all parties to secrecy.

The National Resistance Army waged a 41/2 -year bush war against the civilian government of President Milton Obote, who was overthrown July 27 by a coup.

Several smaller guerrilla groups that were fighting Obote's government have agreed to cooperate with the new military government of Gen. Tito Okello, but the National Resistence Army has held out, demanding a major role in the government.

Among Masaka residents reached by telephone from Kampala were a teacher at an elementary school just outside the city and an unidentified man at the residence of Roman Catholic Bishop Adrian Dungu.

Both said they could hear explosions and persistent small arms fire from their areas.

The Ugandan army has a 500-man garrison stationed in Masaka and residents reached by telephone said much of the fighting was centered there.

The battle began Monday, but the government said it had repulsed the rebel attack by early Tuesday evening.

It appeared, however, that the government forces pulled back or were forced back in the face of another rebel assault early Thursday morning.

''We had earlier heard that the government army had been forced out of town and hoped there would be no more fighting,'' said the teacher, ''but now it seems there is fighting all over the place.''

The teacher and the other Masaka residents reached by telephone spoke on condition of anonymity.

Masaka, the third-largest city after Kampala and Jinja, lies on the main highway to landlocked Burundi and Rwanda.

A week ago, guerrillas cut off the town from Kampala, thereby preventing movement of food supplies from the agriculturally rich southwest to the capital.

In a broadcast on Radio Uganda, Okello reiterated a government pledge to fight only in self-defense when attacked by ''anti-peace elements.''

In an attempt to reassure Masaka residents, Okello also issued a written statement Thursday morning saying, ''The government is determined not to disturb the peace that has prevailed throughout the district ever since the overthrow of Idi Amin in 1979.''

Amin had ruled as a dictator from 1971, when he overthrew Obote.