The chief U.S. diplomat in Cuba walked out in protest over President Fidel Castro's criticism of the Reagan administration during a three-hour speech honoring the 30th anniversary of the Cuban revolution.

In his speech Wednesday night, Castro assailed U.S. threats against Libya for its alleged chemical weapons plant but, curiously, omitted any reference to the U.S. downing of two Libyan jet fighters earlier in the day over the Mediterranean.Castro did say, however, that the United States has the "most powerful" chemical weapons arsenal in the world, then asked, "Why should it deny it to other countries?" Cuba is believed not to possess chemical weapons.

It was shortly after Castro alluded to this that Jay Taylor, who has headed the small U.S. mission in Havana for slightly over a year, rose from his seat in the diplomatic section and strode out.

There was no immediate comment from Taylor.

Meanwhile, after months of uncertainty about Soviet-Cuban relations, Castro offered strong praise for Moscow while bitterly criticizing U.S. policies toward the Third World.

Tens of thousands of spectators were present as Castro inaugurated a permanent fair designed to highlight Cuba's social and economic development over the past three decades.

The public was to have access to the pavillions at the fair starting Thursday.

In several speeches in recent months, Castro has made clear his unhappiness with the liberal reform policies of Soviet President Mikhail S. Gorbachev.

He has indicated his defiance of Gorbachev by affirming Cuba will never adopt any policy that "reeks of capitalism." On Sunday, Castro said Cuba will be guided by a policy of "socialism or death, Marxism-Leninism or death."

Although there was never any doubt the Soviet-Cuban axis would continue, Castro's emphasis seemed to undergo a revival.

"We will never forget the support received (from the Soviet Union) in decisive moments," Castro said. At another point, he said, "We support the policies of peace of the Soviet Union."

He also said Moscow and Havana see eye-to-eye on the international debt issue plaguing many Third World countries. He said that while the United States subjects its trading partners to unequal terms of trade, the Soviet Union has treated Cuba fairly on that same issue.

This was a reference to the Soviet purchase of Cuban sugar at prices above those of the world market and Soviet concessions in the sale of oil to Cuba.

Among those attending the speech were President Daniel Ortega of Nicaragua and Namibian rebel leader Sam Nujoma.

Castro expressed deep concern over a proposal, apparently strongly supported by the United States, for a reduction in the U.N. peacekeeping force that will oversee the pending transition of Namibia to independence from South African colonial rule.

According to Nujoma, the proposal entails a reduction from 7,500 to 3,000 in the U.N. troop presence.