Thousands of homosexual Cubans came to the United States in the Cuba-to-Key West sealift, and as many as 20,000 of them are still in refugee camps awaiting resettlement, federal officials confirmed yesterday.

U.S. and private agency source said the federal government is working with national gay rights organizations to find sponsors for the gay Cubans. Figures obtained from such organization as the Metropolitan Community Church and government refugee agencies indicate that gays account for up to 50 percent of 40,000 Cuban refugees still in camps throughout the country. But all sources cautioned yesterday that their figures are at best estimates.

Exactly how and why so many gays apparently found their way to the United States in the Cuban refugee flow remined a matter of conjecture yesterday.

"We've had this conversation many times with our staff people here, and we still haven't come up with any solid answers," said Bill Traugh, director of Federal Emergency Management Agency refugee operation at Fort Chaffee, Ark.

"All we know is that we have a lot of gay people here among our 10,179 remaining refugees," Traugh said, although he conceded he could not give "hard Figures."

The most common speculation is that Cuban President Fidel Castro wanted to insult the United States by sending this country as many "undesirables," including gays, among the refugees as possible.

"Castro seems to have made it a point to release a lot of gays," said Don Micheals, an editor of the Washington-based gay newspaper, The Blade, which has been investigating the status of the Cuban gays in the refugees camps.

Though homesexuality is not illegal per se in Cuba, it is considered shameful.

For example, even among the Cuban refugees at Fort Chaffee, "the homosexual group is shunned by the general population," traugh said. "Many of the Cuban men are very macho and don't take too kindly to the homosexuals."

Acknowledged homosexuals at the camp have "self-segregated themselves" into two barracks, each holding up to 125 persons, Traugh said. Similar forms of self-segregation have occurred at the remaining three Cuban refugee camps around the country, according to federal and private sources.

Justice Department officials said yesterday the U.S. government no longer bars entry to refugees who are homosexual.

"The Immigration and Naturalization Service no longer keeps people out just because they are homosexual," said department spokesman Robert Havel. "There was a time when they were kept out because homosexuality was considered an illness. But the U.S. Public Health Service no longer sees homosexuality that way . . . and it [homosexuality] is not illegal in the United States," Havel said.

Federal law bars entry to immigrants or refugees who are "sexual deviants." But Havel said that law is rarely applied because it is viewed as being inconsistent with the Public Health Service position that homosexaulity does not necessarily constitute aberrant sexual behavior.

Havel said his agency has ben testifying before Congress to have the law changed.

Representation of national gay rights groups plan to meet here today to study the placement of gay Cuban refugees with gay sponsors. The meeting at the Washington branch of the Metropolitan Community Church is expected to be a working session closed to the press.

The Rev. Larry Uhrig, speaking on behalf of the Metropolitan Community Church in Washington, said his organization has been contacted by the State Department in an effort to help the gay refugees.

Church members here and in Los Angeles have already resettled many of the Cubans, and have been offering clothing and food to gay refugees still in the camps, he said.

A spokesman for the State Department's Force, which has been helping with the search for sponsors, said the group does not consider the gay Cuban situation a problem.

"I don't call it a problem," the spokesmam said. "I see it simply as a challenge and an opportunity before us."