By curious historical happenstance, American attacks against Libya came exactly 25 years after the United States sent a doomed, ragtag fleet of hulking World War II merchant vessels toward its destiny at the Bay of Pigs in Cuba.

That analogy bears examination today not because the air strikes over Libya parallel the disastrous U.S.-sponsored military action against Cuba or because history ever literally repeats itself. Of course, they do not. The Bay of Pigs episode remains pertinent because it continues to offer lessons for American policy-makers grappling with similar questions involving uses of force and how best to deal with leaders of small states such as Cuba, Libya and Nicaragua that the United States deems intolerable menaces.

Here are some of those lessons that seem relevant to events in the Middle East and in Central America:

*On use of force. In his briefing at the White House after the Libyan attacks, Secretary of State George P. Shultz made a major policy point when he said, "What is clear tonight is that the United States will take military action under certain circumstances. That's established. That's very important."

So it is.

From a military standpoint, the central lesson of the Bay of Pigs is that, once American prestige is committed to a military engagement, the United States should never permit failure for lack of adequate force. The Bay of Pigs invasion stands as the classic case of too little and too late and of the consequences of failure.

In this sense, the U.S. action against Libya demonstrates that this lesson has been learned. Sufficient force was committed to achieve the approved military mission.

At the same time, as the long Vietnam experience made tragically clear to all Americans, willingness to employ massive power does not alone assure success and, in fact, can lead to even more division at home and embittering defeat abroad.

Here, a Shultz phrase appears significant in establishing future policy guidelines. That is his pledge that the United States will take military action "under certain circumstances."

He appears to be telling the world that the United States will respond to terrorism, as the president says, whenever and wherever acts of terror are committed against Americans. As long as the case against the terrorists is made convincingly and clearly, the great majority of Americans will surely back use of force against them.

*On covert operations. In the aftermath of the attacks on Libya, the question of administration policy in Central America looms larger as Congress and the American people debate Reagan requests for more aid for counterrevolutionaries in Nicaragua. Here, the lessons of the Bay of Pigs are more pointed and timely.

Of all the disasters that befell the brave men of Cuban Brigade 2506 at the Bay of Pigs in mid-April 1961, none was greater than the nature of the operation chosen to achieve a desired American foreign-policy goal. The Bay of Pigs was, or should have been, proof of the ineffectiveness of large-scale covert military operations in the post-World War II era.

Belief that America could escape responsibility for forming a secret invading army and putting it ashore with a U.S.-drawn invasion plan was a historic blunder. There's no reason to believe that another large-scale covert military force such as the contras, direct descendants of the Bay of Pigs force, will fare better today. If anything, the same reasons exist for predicting its failure. On the role of diplomacy. The greatest failure at the Bay of Pigs was in not understanding the internal forces that produced a Fidel Castro -- or, now, a Muammar Qaddafi in Libya or Daniel Ortega in Nicaragua.

In all of these cases, the administration in power misread those forces and misunderstood the appeal of leaders and regimes that the United States found repugnant. It was assumed, for instance, that the people of Cuba would join the invaders in overthrowing Castro, the presumably hated communist leader. They did not. To them, Castro was a hero. He continues to be so regarded by many of them.

Similarly, too much of the planning against Castro's Cuba centered on military rather than diplomatic actions, on launching strikes and invasions rather than on developing policies that could change underlying conditions and attitudes that had made Cuba fertile ground for communism.

Of concern now is whether U.S. policy-makers will avoid the same kinds of mistakes in dealing with another problem of the age: terrorism.