Thousands of black Haitians seeking political asylum here were denied due process because of selective and discriminatory federal immigration policy, a U.S. District Court judge ruled yesterday in Florida.

Judge James Lawrence King held that the government, following a line of discrimination and political expediency, illegally rejected asylum claims of more than 4,000 Haitians in 1978 and 1979.

In a strongly worded, 180-page opinion, King said that the Immigration and Naturalization Service had followed a "systematic program designed to deport them irrespective of their asylum claims."

"This case involves thousands of black Haitian nationals," the opinion begins, "the brutality of their government, and the prejudice of ours."

The judge also issued a lengthy and grim report on current politics in Haiti, which he termed "stark, brutal and bloody."

King directed INS to reprocess the claims of the refugees, most of whom landed in south Florida seeking work after perilous trips by sea from their impoverished homeland.

The judge ordered that each of the claims must be reviewed individually by INS, with full attention to the Haitians' assertions that they face political repression or worse if deported.

Officials at INS and its parent Department of Justice declined yesterday to comment on any aspect of the judge's ruling.

During months of testimony in King's Miami courtroom, attorneys for the Haitians argued that INS, ignoring its own due-process requirements, had refused to considier the Haitians' political fears.

But the judge held that there was no way the government could reasonably ignore the politics of Haiti. He made a scathing, 80-page assessment of conditions there, and dismissed a U.S. State Department defense of the Haitian government as "unworthy of belief."

The judge commented at length on the atmosphere created in Haiti by President for Life Jean Claude Duvalier and his late father, known as Papa Doc, which he said had been described accurately as the most oppressive in this hemisphere.

King said that the U.S. government's refusal to weigh political considerations with economics was, at best, myopic. "Much of Haiti's poverty is a result of Duvalier's efforts to maintain power. . . . It could be said that Duvalier has made his country weak so that he could be strong."

The judge said that the INS reaction to this had been "somewhat callous" and its treatment of the refugees a violation of the U.S. Constitution that "must stop."

INS, according to witnesses and documents, apparently adopted a policy in mid-1978 to deal with what Washington officials considered "the Haitian problem."

The policy directed that all arriving Haitians be detained, classed as "economic refugees" -- that is, as aliens here only for economic reasons -- and moved as quickly as possible through processing to deny them legal status.

Haitian exiles and American civil rights and civil liberties groups insisted at the time that the INS attitude toward the Haitians carried overtones of radical discrimination.

King dealt with that point at some length, contrasting the official federal attitude toward the Haitians with the government's open-arms treatment of lighter-skinned Cubans fleeing the regime of Fidel Castro.

The judge noted that prior to the most recent wave of Cuban arrivals -- the more than 17,000 who came on boats in May and June -- "all the Cubans who sought political asylum were granted asylum routinely."

Yet, King continued, "none of the over 4,000 Haitians processed were granted asylum. No greater disparity can be imagined."

The plight of the Haitian boat people, and the pressures their arrival caused for Florida government and private welfare agencies, drew international attention as the refugee tide swelled last spring.

But their status here is caught in a tangle of policy questions. King's order yesterday covers an estimated 4,000 to 5,000 of the Haitians, mostly in south Florida. They can remain in the United States while their cases are reprocessed by INS.

Thousands more who arrived before June 19 are eligible to remain on "parole" status under a policy laid out last month for both Cuban and Haitian refugees by the Carter administration.

Those with parole are eligible for employment and certain federal and state benefits while Congress and the administration work out a way to settle questions about permanent residency.