President Fidel Castro of Cuba, responding to accusations by President Reagan, said today that Reagan is a "liar" and "the worst terrorist in the history of mankind."

Castro's harsh comments, relayed from Havana by news agencies, followed a long period during which he avoided strident comments about Reagan or the United States.

The tough language underlined what Cuban officials in Havana have described as disappointed hopes of improved relations in Reagan's second term. A high-ranking Cuban Foreign Ministry official said recently that, in the light of Radio Marti and other disputes, Castro's government now sees little prospect of improving the climate with Washington "at least" until a new U.S. president is elected.

Castro, 58, has gone out of his way in recent months to project an image of statesmanship, seeking improved relations with South American governments. In particular, he repeatedly has warned that Latin America faces social "explosions" unless some way is found to lighten the burden of its foreign debt, owed mostly to U.S. banks.

Reagan apparently stirred Castro's ire particularly with his speech to the American Bar Association on terrorism yesterday in which he included Cuba among five "outlaw" nations that he said constitute a "new international version of Murder, Inc.," ruled by "the strangest collection of misfits, looney tunes and squalid criminals since the advent of the Third Reich."

In a news conference with the Latin American Journalists' Federation, gathered in Havana, Castro referred to Reagan's rhetoric:

"How can you take this man seriously? Perhaps even he doesn't know what he is talking about . . . . He is the biggest liar of all the American presidents, . . . the worst terrorist in the history of mankind."

Castro, in his wee-hours talk with the journalists, cited three examples of what he called "American terrorism." These were U.S. support of the Army in El Salvador, CIA mining of Nicaraguan harbors and the U.S. invasion of Grenada in October 1983.

Castro called Reagan "a madman, an imbecile and a bum," Reuter reported, which also quoted him as saying: "His ideas are from the era of Buffalo Bill, not the nuclear age."

Cuba has for some time figured on a list of countries that the State Department says have supported international terrorism.

Castro, bristling at Reagan's language, said the president and his advisers seem "nervous and irritated" at the attention Castro has gained with his campaign for solutions to Latin America's foreign debt.

In speeches and interviews, Castro has suggested that the U.S. government assume the debt from the mostly U.S. creditor banks so the banks can release Latin American governments from the obligation to pay. Three pouches full of literature on the suggestions disappeared this weekend on the way from Havana to distribution at the United Nations, Castro said.

"I am sure the CIA had something to do with it," he added.

Reuter reported these additional responses to Reagan:

Libya, another of the nations blasted by Reagan as being behind international terrorism, accused Washington of "state organized terrorism."

Libya's national news agency JANA said Reagan considered as terrorism anything "opposing U.S. policies that aim to dominate and control other people."

The Nicaraguan Embassy in Washington issued a statement saying, "No amount of incendiary rhetoric will hide the fact that the U.S. administration promotes the systematic use of terrorism against the Nicaraguan people. If the U.S. is on the side of international law, why is it so afraid of the World Court?"

There was no immediate response from Iran or North Korea, the other countries named by Reagan.