The CIA has played a direct role in the laying of underwater mines in Nicaraguan ports that have damaged at least eight ships from various nations during the past two months, according to congressional and administration sources.

A combination of U.S.-financed guerrillas fighting the leftist Sandinista government of Nicaragua and more highly trained Latin American employes of the CIA operating from CIA-owned speedboats have laid the crude bottom-lying mines in Corinto and other ports, according to the sources.

They said that the mining operation is part of a CIA effort that began late last year to redirect the "contras," as the anti-Sandinista guerrillas are known, away from futile attempts to seize territory and toward hit-and-run economic sabotage.

The handmade acoustic mines, which explode noisily but are unlikely to sink a ship, reportedly are intended to harass and discourage shipping rather than blockade the harbors. Officials said that they are having the intended effect, with Nicaraguan coffee and other exports beginning to pile up on piers and imported oil running short.

The harbor mining began about two months ago without advance notification of congressional intelligence committees but probably with the general knowledge of President Reagan, according to sources close to the intelligence community.

At the same time, the sources said, the CIA began to assume a more direct role in training and guiding the anti-Sandinista rebels, shouldering aside the Argentinians and Hondurans who had been playing a middleman role.

The increased activity coincided with a growth in the strength of the contras from about 15,000 to closer to 18,000. The increase in strength, which one knowledgeable source said was carried out without congressional notification, came particularly among the forces of Eden Pastora in Costa Rica, to which an entire Sandinista battalion of about 250 men reportedly defected.

News of the more direct CIA involvement in the "covert" war against Nicaragua came as the Senate approved an additional $21 million in CIA support for the contras. The administration says the funds are intended to discourage Nicaragua from supporting leftist rebels in El Salvador. The appropriation faces a stiff fight in the Democratic-controlled House, which last year twice rejected the request.

The $21 million appropriation is attached to legislation that includes $61.7 million in military aid for the government of El Salvador to fight leftist insurgents there. Rep. Dante B. Fascell (D-Fla.), chairman of the House Foreign Affairs Committee, said yesterday that he believes the House will be inclined to approve the El Salvador aid, but that the attached money for the contras "may make it very difficult to pass it in the House."

Some officials indicated that there is concern within the administration that the mining, which Nicaragua has attacked as state-sponsored "terrorism," will alienate U.S. allies and be seen as contrary to international principles of open seas. There is also concern that sabotaging the Nicaraguan economy may alienate Nicaraguans whom the CIA hopes the contras will win over.

"There is always a delicate balance that any insurgent movement has to strike," one senior official said.

There is evidence that U.S. allies in Europe have become increasingly unhappy about the mining and the reported U.S. role in it. It was disclosed Thursday that the French government offered to help Nicaragua, which has no mine-sweeping equipment, to clear its harbors if other European nations join in.

Diplomatic sources confirmed yesterday that the British government, in informal but regular contacts with the State Department, has made clear that it, too, deplores the threat to international shipping that mining harbors represents. The British did not claim that the CIA is involved and did not offer to help remove the mines. But British officials, stressing that they are a seafaring nation, said they communicated their concern as a matter of principle.

State Department spokesman John Hughes said yesterday that Washington has "raised our concerns" diplomatically with the French government about the reports that France has offered to help the Nicaraguan government clear away the mines. He said that the United States was not notified in advance of the French offer.

"We have all along been concerned with the large Soviet and Cuban military relationship with Nicaragua. And we would not favor any nations contributing to Nicaragua's ability to export revolution," Hughes said.

Hughes suggested that there is some doubt about the French intention to aid Nicaragua, despite the offer contained in a letter from Foreign Minister Claude Cheysson to Colombian President Belisario Betancur. The letter was made public Thursday in the Nicaraguan newspaper Barricada, the voice of the Sandinista National Liberation Front.

Secretary of State George P. Shultz was questioned about the mining of Nicaraguan habors during a luncheon meeting Thursday with reporters and editors of The Washington Post.

Asked whether Washington has any control over the mining operations, Shultz said, "I don't have any comment to make about that." Asked what the purpose of the mining is, he said, "You have to ask the contras about that . . . . It looks like the purpose must be somehow to interrupt the commerce of the country."

Although the official purpose of the CIA-supported war is to discourage Nicaraguan support for the leftist rebels in El Salvadora, administration officials have suggested from time to time that they also are interested in making the Sandinista government in Nicaragua more "democratic" and less tied to Cuba and the Soviet Union.

Critics have charged that the administration is aiming to overthrow the Sandinista government, which replaced a right-wing dictator in 1979. Sen. Edward M. Kennedy (D-Mass.) called the administration's aid bill "shameful and dangerous."

Sen. Joseph R. Biden Jr. (D-Del.), a member of the Senate Intelligence Committee, told his colleagues that they would vote against the bill "if you knew what I know."

"You are right in opposing this money going for the purposes allegedly stated here because they ain't the real reasons," Biden said.

Nicaraguan officials have said that ships from the Netherlands, Japan, the Soviet Union, Britain and elsewhere have been damaged by mines in ports on both the Caribbean and Pacific coasts in recent months. Nicaraguan radio said that the mines are "highly sophisticated and manufactured by the arsenals of the U.S. armed forces."

But sources here said that they are simple devices that can be manufactured from easily obtained, "off-the-shelf" materials. The mines are triggered by the sound of a ship on the surface and explode with a loud bang that can cause extensive damage but--unlike a floating mine--is unlikely to sink a ship.

Although Miskito Indians and both major contra groups have been involved in mining and attacking Nicaraguan ports, Latin American contract agents of the CIA with skills in fusing weapons and piloting boats also have been involved, sources said. The sources said that the mines can be heaved over the side of speedboats.

One congressional source close to the intelligence community said that Reagan probably gave the mining "a broad-brush kind of approval . . . with no concern with the details." Another said, "If the president didn't approve it, then you'd have a real story, and I don't think you have a real story there."

One official said the mining has caused concern among Reagan supporters in Congress as well as the administration, but added, "The goal of this has been to put as much pressure on them the Sandinistas as possible."

The CIA became concerned late last year, in part due to congressional pressure, that "very basically the progress wasn't going forward at a rate that was going to give us any chance of success," one official said. At that time, the Argentinians, who were pulling out anyway, and Hondurans increasingly were supplanted by CIA employes in training and directing the contras.

In particular, the U.S. urged the rebels to stop massing in large groups to strike from Honduras and capture territory, a tactic that gave the Nicaraguans inviting targets for retaliation. The rebels were encouraged to have small sabotage operations instead.