A Salvadoran Army hunter battalion was badly beaten in a textbook guerrilla ambush over the weekend, the military's most damaging defeat in five months, foreign officials and Salvadoran Army sources said today.

The attack, which pointed up weaknesses in the Salvadoran armed forces, occurred Saturday in the hamlet El Salto, about 25 miles southeast of here.

The attack appeared to put into question statements by U.S. military officials and Salvadoran Army spokesmen that government forces have taken the initiative in the five-year-old guerrilla war here.

According to an Army communique issued by armed forces spokesman Col. Ricardo Cienfuegos today, 45 soldiers were killed, including one officer, and 35 wounded.

A report of the battle broadcast today by Radio Venceremos, the rebels' clandestine radio station, said there were 103 Army casualties, including 60 killed.

Radio Venceremos claimed that rebel units had taken prisoner 46 soldiers of the Nonualco Battalion, including two cadets, and captured 104 M16 rifles, six M60 machine guns, one 90-mm recoilless rifle and 14,000 rounds of ammunition.

Cienfeugos said he could not confirm the rebel claim of prisoners or captured armaments because "we don't have a full picture yet." But a military observer who visited El Salto with a Salvadoran Army relief column yesterday said, "It was a pretty big battle and there is no question that they [the Army] got bloodied pretty good."

According to the military observer, bodies, many stripped of their uniforms and weapons, were scattered on the outskirts of the hamlet.

The military observer said that a full two companies of the 350-man battalion had been driven off when they sought to enter the town last Saturday to relieve about 25 local Civil Defense men who had reported guerrillas in the vicinity to the battalion command in the provincial capital of Zacatecoluca, about four miles to the south.

The other two companies of the battalion apparently were pinned down during the ambush and, the military source said, were unable to radio for help, presumably because the rebels were jamming their transmission.

The battle lasted close to seven hours, according to Radio Venceremos. Foreign observers with close ties to the Army said the armed forces did not begin to send relief forces to El Salto until Sunday morning and these did not arrive in town until yesterday, about 36 hours after the battle ended.

When they did arrive, they found only the bodies of the dead soldiers and no guerrillas. A military observer who traveled with them said there was no sign of any guerrilla dead in the area. Residents of the hamlet said the rebels had withdrawn to the east "carrying many wounded."

The defeat seemed to belie U.S. officials' optimistic assessment of the Salvadoran armed forces performance in recent months. Since the United States began to say the Salvadoran Army had the advantage several months ago, the guerrillas have dodged a major government offensive in Morazan province, one of their main strongholds. During the offensive, its main planner, Col. Domingo Monterrosa, and two other top field officers were killed in their helicopter. According to Radio Venceremos, the Army suffered 259 casualties. During the 48-day operation, the rebels avoided any of the sort of direct clashes that would have allowed the Army's superior firepower to inflict serious casualties on them.

The rebels also raided the town of Suchitoto during that period, damaging at least two helicopters and killing about 35 government troops; ambushed dozens of trucks carrying soldiers, and attacked power plants and coffee processing mills.

Foreign officials say that since the Army began its major thrust in Morazan, there are indications that the guerrillas have moved into the coffee-rich western part of the country where they had not operated before, thus widening the war and forcing the Army to begin to watch its western flank.

"I think it is clear that the guerrillas have picked up the pace on their side," the military observer said today.

The ambush at El Salto, which came a day after rebel leaders held their second round of peace talks with government representatives, was the major military defeat for the Salvadoran Army since it lost more than 100 soldiers killed June 27 during a guerrilla raid on the Cerron Grande dam complex, north of the capital.