The White House reacted angrily Friday to the detention and reported torture of a U.S. narcotics agent by Mexican police, charging that he was beaten and jabbed with a cattle prod and warning that the incident could damage diplomatic relations with Mexico.

One administration official said Mexican police also forced ''mineral water up the nose'' of Drug Enforcement Administration agent Victor Cortez during a brutal six-hour interrogation.

''The feeling here is outrage,'' the official said, speaking on condition that he not be identified.

The incident happened Wednesday, while Mexico`s President Miguel de la Madrid was visiting President Reagan and other U.S. officials in Washington.

White House spokesman Larry Speakes denounced the incident as unjustified ''vigilantism'' and said the U.S. would file a formal diplomatic protest.

Atty. Gen. Edwin Meese said the United States ''is not going to stand for this kind of conduct.''

Cortez, 34, a DEA agent from Arizona who was stationed in the Jalisco state capital of Guadalajara, was detained, beaten, tortured and interrogated for six hours by Jalisco state police before being released late Wednesday, Speakes said.

''The United States protests the unprovoked and totally unjustified detention and torture of one of its officials,'' Speakes said. ''Vigilantism by state authorities causes serious harm to the relationship necessary for our two countries to be able to combat drug trafficking and production.''

In Mexico City, the federal attorney general`s office said late Friday that it would send an official delegation to Washington in the next few days to brief U.S. authorities on the course of the investigation into Cortez`s arrest.

Although the attorney general`s office originally had denied categorically that the DEA agent had been tortured, the latest statement said only that an investigation is underway. It pointedly omitted any denials of wrongdoing by Mexican officials in Jalisco state.

Speakes said that although Cortez immediately identified himself to police as a DEA agent working with the knowledge and consent of the Mexican government, he was detained for six hours.

''The police threatened Mr. Cortez and beat him and tortured him with a cattle prod during the interrogation,'' Speakes said. ''We certainly don`t have any doubt that there was torture.''

DEA Administrator John Lawn said, ''Cortez was brutalized.'' He was

''stripped, bound, beaten and prodded with a cattle prod.''

Lawn said eight police officers picked up Cortez and an unidentified Mexican as they drove in the Mexican`s car in Guadalajara Wednesday afternoon. Lawn said the police knew Cortez but twice refused his requests to phone another DEA agent or the U.S. Consulate to confirm his identity officially.

Lawn said Cortez was tortured by ''corrupt individuals . . . trying to determine the nature of DEA operations in Mexico.''

''It`s a tragedy,'' Lawn said, ''that any government would term them police officers.''

Lawn also said the abduction was probably prompted by a recent DEA seizure of more than 1,000 kilograms of cocaine in Mexico.

Lawn said Cortez`s Mexican companion was also beaten, but not as severely, and was now somewhere in the United States.

Cortez, who often worked closely with Mexican authorities, was flown Thursday to Tucson, where he spent the night in an apartment. He went to a hospital Friday for an examination and was released.

Lawn said he had multiple abrasions on both legs and a contusion on his right shoulder but was feeling ''perky.''

Manuel Alonso, a spokesman for De la Madrid, said in Mexico City that Jalisco authorities reported that ''there were two men discovered with high-caliber weapons in a car who were suspicious.''

''They were detained and were taken to the offices of the police, where they verbally identified themselves--one of them as an agent of the DEA

--because this is customary with this type of agents. They don`t carry any type of identification on them, so once they were identified really as what they said, they were liberated,'' Alonso said.

Lawn said there were automatic weapons in the trunk of the car but they were not Cortez`s. Lawn said he did not know why they were there.

The incident was a major embarrassment for De la Madrid, who wound up a generally harmonious three-day visit to Washington Thursday in which he met with Reagan and other top administration officials to smooth over strained U.S.-Mexican ties.

The U.S. has been trying to get the Mexican government to increase its cooperation in efforts to stop drug smuggling along the border. That effort has been marked in recent weeks by increasing complaints from many U.S. officials about widespread corruption among Mexican police.

Disclosure of Cortez`s detention and torture also underscored the lingering resentment between the two nations over the unsolved kidnap and murder last year of another DEA agent, Enrique Camarena Salazar, at the hands of drug traffickers in collusion with Jalisco police.

Although several suspects have been arrested, the Reagan administration is convinced that some people involved in the killing are still at large.

Cortez was released after Meese asked his Mexican counterpart, Sergio Garcia Ramirez, to intervene in the case. Meese said the Mexican attorney general ''pledged to prosecute whoever is responsible.''

Cortez, who was born in Brownsville, Tex., has been a DEA agent since 1978. Before that, he was a border patrol officer with the Immigration and Naturalization Service. He is married and has two children.