WASHINGTON (AP) _ Congress, in the midst of considering a Reagan administration request for extra aid to the Nicaraguan rebels, has heard testimony that the Nicaraguan government illegally helped send cocaine to the United States.

A former official of the leftist government told a House committee Tuesday that the Sandinistas's drug trafficking was controlled by Tomas Borge, Interior minister and head of the leftist government's police forces.

And a Reagan administration official told the same House Foreign Affairs narcotics task force that there is evidence of the Sandinista participation in the illegal drug activities.

The hearing came during a campaign by President Reagan to win congressional approval for $100 million in aid to the U.S.-backed Contra guerrillas fighting the leftist Sandinista government.

But Rep. Larry Smith, D-Fla., chairman of the task force, denied the hearing was scheduled to coincide with Reagan's effort.

''This hearing has been planned for several months and its timing is totally unrelated to the president's request,'' Smith said.

Jose Alvaro Baldizon Aviles, a former special investigator in Nicaragua's Interior ministry, defected from Nicaragua last summer, escaping on foot across the border to neighboring Honduras.

He has told his story about alleged Nicaraguan involvement in drug trafficking before, but Tuesday's appearance was his first testimony to a congressional committee.

The Reagan administration has maintained that Nicaragua is involved in the shipping of cocaine to the United States.

Jon R. Thomas, assistant secretary of state for narcotics issues, told the panel, ''There is evidence suggesting that members of the Sandinista government have not only condoned, but have actively participated in, narcotics trafficking activities.''

Baldizon, testifying in Spanish, said through an interpreter that he first became suspicious in 1982, when Borge ''issued an order that all cocaine, dollars and gold had to be turned in to his office.''

''It was obvious that the confiscated narcotics, gold and dollars were being sent to places not provided for by law and those involved were being set free,'' he told the task force.

Baldizon said he started his own investigation in 1983 after a woman named Jacqueline Lyons Pastora was arrested with four ounces of cocaine. She said she was working for the government, Baldizon said, and that was why she had the drugs.

''At the conclusion of the investigation, we established that high government officials were involved in cocaine trafficking to Miami,'' Baldizon testified.

He said he turned the investigation's results over to Borge and was reprimanded because he started an investigation without official sanction. Baldizon said he also was told by Borge that in the future, information about cocaine was to be sent directly to Borge rather than being investigated by Baldizon's unit.

Two years ago, Baldizon said, he saw internal Ministry documents, which he said confirmed the allegations of involvement in drug trafficking. When he approached Borge to discuss the matter, Baldizon testified, he was told it was being done to make money that would finance espionage operations.