Two dozen foreigners, including Mexican police and military officials, were named yesterday in two major federal indictments in a weapons-smuggling conspiracy and a massive operation to smuggle cocaine from Bolivia to the United States.

The drug indictment, which grew out of a yearlong investigation by the U.S. Customs Service and the Drug Enforcement Administration, charged six Mexicans and six Bolivians with running a cocaine-smuggling operation from Bolivia to the United States with protection provided by the Mexican Army for aircraft refueling stops in Mexico.

The Mexicans named in the drug case included an Army general, two colonels and one man who described himself on surveillance tapes as a commandante in the Mexican Federal Judicial Police, which is equivalent to the Federal Bureau of Investigation, assigned to the attorney general's office.

The weapons indictment charged 12 Mexicans, including eight members of the Mexican Federal Judicial Police, three state policemen and one member of the Mexican Customs Service, with illegally exporting semi-automatic assault rifles and semi-automatic pistols to Mexico from a San Ysidro, Calif., gun shop. The gun shop owner and an employee also were charged.

Federal law enforcement officials, who asked not to be identified, said they believe the weapons were being re-exported from Mexico to other parts of Latin America. That investigation was conducted by Customs and the Bureau of Alcohol, Tobacco and Firearms.

Federal law enforcement sources said the two cases were considered especially important to ongoing federal investigations of U.S. crime related to official corruption in Mexico.

But they said the indictments, which were unsealed in San Diego and normally would have been announced in Washington, were played down because of State Department concern about a summit meeting scheduled in Mexico next month between President Reagan and Mexican President Miguel de la Madrid.

According to U.S. Attorney Peter Nunez, who announced the two indictments, the Bolivian cocaine organization was able to produce 200 kilograms of cocaine a day and was stashing it at "a major complex of clandestine airstrips" in Bolivia and Brazil to await shipment to the United States.

John Hensley, the Customs Service's assistant regional commissioner for enforcement on the West Coast, called the Bolivian group "one of the major narcotics trafficking groups in the world."

He said the Customs Service received information about the scheme last year after Commissioner William von Raab publicly criticized involvement by Mexican political officials in drug trafficking into the United States. Von Raab was not available for comment yesterday.

Under the plan, DEA and Customs undercover agents posing as American drug traffickers operating from a beach house in La Jolla, Calif., were to purchase five metric tons of cocaine for $25 million from the Bolivian group.

The drugs were to be flown to Mexico, where the plane would stop for refueling near the town of Puebla, southeast of Mexico City, under the protection of the Mexican Army. U.S. law enforcement sources said the payment to the Mexicans for protection was to be $1 million for each metric ton of cocaine -- plus 12 televisions, 12 videocassette recorders and two pounds of cocaine for the soldiers who blocked access to the drug plane.

But the U.S. agents decided not to land in Mexico because of concerns that the drugs or cash might be stolen by the protectors.

Seven of the 12 defendants in the drug case were lured to San Diego with promises of payments. They were arrested Thursday by federal agents. All face sentences of up to life in prison and multimillion-dollar fines. At least one of the others, the money launderer, a Bolivian living in Panama, was being sought yesterday in Panama.

None of the defendants named in the firearms indictment was in custody, and federal officials said that since there is no extradition treaty with Mexico, they are unlikely ever to be tried.