The suspected mastermind in the slaying of an American drug agent in Mexico was captured in Costa Rica yesterday, and Attorney General Edwin Meese III said the United States will seek his extradition to stand trial in this country.

Mexican police had allowed Rafael Caro Quintero -- reportedly the country's top drug trafficker -- to flee in his private jet in February despite information from the U.S. Drug Enforcement Administration that he was a suspect in the murder in Guadalajara of DEA agent Enrique Camarena Salazar, according to the DEA.

Caro Quintero, 32, and four bodyguards were arrested at a "luxurious" hacienda in San Jose by Costa Rican police acting on information provided by the DEA, according to DEA Acting Administrator John C. Lawn.

With the suspects was a 17-year-old girl, identified as Sara Cosio Martinez, niece of a former Guadalajara mayor. She told police that Caro Quintero had kidnaped her in Mexico, DEA agents said.

Costa Rican officials described the incident as a major gun battle, but DEA officials here said only one warning shot was fired after a bodyguard moved to draw a weapon.

DEA agents reportedly did not participate in the raid although they were nearby.

Meese told a news conference here that the Justice Department will seek Caro Quintero's extradition to the United States, where he could be prosecuted under a criminal law stating that those who injure or kill federal officials in foreign countries can be prosecuted in the United States. But the Mexican government also is seeking Caro Quintero's extradition, Meese said, and it is unclear which country would have first claim on him.

"We might want to get him here after he serves 99 years in Mexico," Meese said.

When asked whether he was concerned that Caro Quintero would not be prosecuted aggressively in Mexico, Meese said: "We have no reason to believe that they won't be aggressive with reference to their charges."

A State Department spokesman said the U.S. government "welcomes" Mexico's attempt to have Caro Quintero extradited; he called it "a significant step forward in the government of Mexico's efforts to stamp out drug trafficking."

A Costa Rican official last night said Caro Quintero could be returned without formal extradition proceedings because he entered that country illegally, the Associated Press reported.

DEA agent Camarena, a Mexican-born naturalized American, was killed after being abducted by men waiting in a car when he left his office in Guadalajara. A Mexican pilot who worked part time for the DEA was abducted elsewhere the same day and murdered.

The bodies were found a month later on a roadside near the city of Zamora, 60 miles southeast of Guadalajara. The bodies had been buried elsewhere and exhumed before being dumped on the roadside, the DEA said.

Caro Quintero is believed by DEA officials in Mexico to be worth at least $500 million and to have a fleet of jets and 300 ranches and estates. Officials here said he is tied to opium-poppy and marijuana cultivation and has worked with Colombian cocaine traffickers.

Lawn said yesterday that a pistol taken from Caro Quintero bore the stamp of the Mexican Federal Directorate, the Mexican federal police. Officials also confiscated other weapons, $40,000 in cash and $150,000 in checks, he said.

"Caro Quintero denied his identity," Lawn said. ". . . He claimed he was one Marcos Antonio Rios Valenzuela and denied that he was involved.