Haitians detained in camps around the United States while appealing for asylum are victims of a discriminatory immigration policy, an attorney for Haitian refugees argued in U.S. District Court here today.

Ira Kurzban, who represents most of 2,200 Haitians detained in U.S. medium-security camps, also contended the government knew that its decision a year ago to detain illegal immigrants would hit Haitians hardest, in violation of the federal Administrative Procedures Act.

The class-action suit challenging federal detention of Haitian refugees who are seeking asylum opened today before Judge Eugene Spellman.

Two former general counsels of the Immigration and Naturalization Service testified that since 1954 aliens seeking entry to the United States have not been incarcerated unless they were considered security risks or likely to flee.

The former INS attorneys, Charles Gordon and Sam Bernsen, who are now Washington immigration lawyers, also testified there has never been a policy of detaining an entire nationality nor of subjecting them to mass exclusionary hearings, as the INS has attempted against the Haitians. Gordon was general counsel of INS from 1966 to 1974; Bernsen from 1974 to 1977.

In most cases, they said, aliens are parolled without incarceration while their asylum claims are being reviewed. "It's my opinion that to deny parole to an entire nationality would be arbitrary and capricious and therefore unlawful," Bernsen said.

Even before the Reagan administration formalized its crackdown against immigration of undocumented refugees last summer, the government "was very aware that Haitians were going to be the butt of this policy," Kurzban argued.

Another witness, the Rev. Msgr. Bryan Walsh, a Catholic Relief Services representative in Miami, testified that Haitians have been treated differently from Cubans since the Haitian influx began in 1972.

He said Cubans were granted refugee status and work authorizations almost immediately while Haitians "who arrived on the same small boats in the same time periods" were denied these privileges.

Detention, contended Kurzban, is "a policy of deterrents . . . to show other Haitians who come into the United States they will not be welcome here . . . that's impermissible discrimination." He cited a March 6 federal court ruling that held the government had illegally detained eight Haitian refugees in Brooklyn by refusing to release them on parole until their asylum bid was decided.

Unless the government can show in writing why there is a danger a particular refugee might flee, U.S. District Judge Robert L. Carter ruled, INS officials must release the Haitians under reasonable conditions.

Judge Spellman has approved a special Dade County Bar Association program to provide 225 volunteer lawyers to represent Haitians in exclusionary hearings here.