SAN SALVADOR, El Salvador (AP) _ Scores of leftist rebels allowed to leave El Salvador in a complicated exchange arrived in Panama City today on their way to Cuba following the release of President Jose Napoleon Duarte's daughter, who had been held hostage for six weeks.

Seventy-six guerrillas, 73 wounded fighters and three rebel commandants who had been captured by the government, arrived in Panama City from San Salvador aboard a Panamanian jet. Panamanian military officials told The Associated Press they would be flown to Cuba.

A Cuban plane and Cuban diplomats were on hand to meet the rebels. Another group of 23 wounded rebels reportedly was flying to Mexico City.

Two of the wounded rebels were carried out on stretchers, and many were missing arms and legs.

In addition to freeing Ines Guadalupe Duarte Duran, 35, and a friend, Ana Cecelia Villeda Sosa, the guerrillas were known to have released nine of 38 mayors and municipal officials the government believes were kidnapped by the leftists and whose release was part of the exchange agreement.

The exchanged, worked out during weeks of complicated bargaining, included the two women, 96 wounded guerrillas who had been under treatment in rebel hospitals allowed by the government to leave the country, 22 political prisoners held by the government, and the municipal officials.

Durate said his daughter, released Thursday, was generally in good shape.

''She is tired, apparently they made her walk three days in a row. She has nervous tension, which you may understand is normal after having been kidnapped more than 40 days. She is happy to be with her father, her mother and her children,'' the president told reporters.

Presidential adviser Julio Adolfo Rey Prendes said 18 of the 22 political prisoners opted to remain in El Salvador, and one, a Costa Rican pilot convicted of flying weapons to the rebels in 1981, was turned over to his nation's embassy in San Salvador.

The three who arrived in Panama City early today were Nidia Diaz, who took part in peace talks with the government last year; Marcellino Reyes, a Honduran; and Santiago Rauda.

All 22 prisoners were on a list of 34 rebels the kidnappers demanded by released in exchange for the women. Three were freed earlier, leaving nine on the list the government said it could not account for.

After being released in Tenancingo about 25 miles northeast of the capital, Mrs. Durate Duran and her friend, abducted Sept. 10 in San Salvador, flew back to the capital by helicopter.

Mrs. Duarte Duran, in blue jeans and a light blue jacket, ran to her parents and her three children and embraced. They posed briefly for photographers and left by motorcade for home.

''They were crying,'' said Rey Prendes, when asked what they said. ''So was I.''

Rey Prendes said the government believed as many as 38 municipal officials may be among the kidnap victims released. He said the number was based on last-minute calls from people with missing relatives who had heard a release agreement was near, and said the number was not firm.

Previously, the government had said there were 21 mayors and three municipal secretaries held by the rebels.

The deal for the release was made at meetings in Panama between the government and the rebels. Rey Prendes said private agreement were also made in addition to the public dealings that led to freedom for the hostages, prisoners and wounded rebels.

He acknowledged there were feelings that El Salvador's government may have given away too much but said, ''It ended not too badly. They freed about 38 (the mayors and other officials) and we sent 21. That is the real exchange.''

He said the permission for the 96 wounded to leave was ''humanitarian.''

''We have let that happen before without any pressures or exchange,'' Rey Prendes said.