A federal court judge in Virginia ordered the U.S. Labor Department yesterday to approve the importation of about 5,000 foreign workers to pick apples, an action that Labor Secretary Ray Marshall called "an alarming precedent."

Marshall said the order by U.S. District Court Judge James C. Turk to let in as many pickers as East Coast growers want would "undercut the ability of the Labor Department to control the importation of foreign workers."

"We intend to take every legal and administrative step at our disposal to prevent this unfortunate order from taking effects," Marshall said in a statement yesterday.

Apple growers in nine affected Eastern states, led by the Frederick County Fruit Growers Association in Winchester, Va., hailed the judge's decision in the latest in a series of court fights with the Labor Department as one that will insure a competent work force to pick their apples.

Delmer Robinson, president of the Frederick growers association, said, "The Labor Department does not want to see any foreign workers come into this country because they are embarrassed we have the high unemployment we have here they cannot produce any domestic workers to do the job."

Marshall said the department estimated that only about 2,000 foreign workers are needed ot help in an apple harvest that will begin in early September, peak in mid-month and continue through October.

"I am deeply concerned that the importation of this large number of foreign workers will deprive abotu 3,000 American workers of needed jobs," Marshall said.

"I know the growers prefer foreign workers because they find them more docile than domestic workers. But with unemployment at 6.9 per cent, this is not a valid consideration," Marshall said.

The public statements of officials on both sides of the dispute were far softer than the often bitter, accusatory, off-the-record comments by both sides.

Growers said the Labor Department was trying to kill the foreign worker program, had forced a summer-long series of court fights and was harassing a small industry.

Labor officials said the growers had used legal tactics to subvert efforts to get domestic workers, "were loing everything they can not to take domestic workers" and had shown "a total unwillingness to obtain Puerto Rican workers."

Judge Turk, who sits in Virginia's Western District, ordered the Labor Department Aug, 24 to certify that not enough domestic labor was available to harvest the apple crop in Virginia, West Virginia, New York, Vermont, Massachusetts. New Hampshire, Connecticut, Rhode Island and Maince.

A federal judge in Puerto Rico had issued a conflicting oreder barring the department from granting certification until it had determined how many Puerto Rican workers were available. Puerto Ricans are considered domestic workers in applying for the apple-picking jobs, which pay a minimum of $2.63 an hour in Virginia, compared with the minimum wage of $2.30 and hour. Workers are paid piece-growers say a good picker can earn $4 an hour.

Separate appeals courts overturned the Puerto Rican order and upheld Turk last Friday, and on Tuesday the Labor Department was ready to certify 2,199 foreign workers. Certification is required before the U.S. Immagration and Naturalization Service will issue temporary visas to the workers.

The growers, charging that the 2,199 figure was only token compliance with, the court ruling, went back before Turk on Tuesday. They argued that immediate action was necessary to avoid crop loss. Turk directed the Labor Department to certify the full 5,1534 foreign workers requested by the growers less the number of domestic workers whose names and addresses the department could supply by 4 p.m. yesterday.

Labor officials called the judge's requirement for a list of names under a 24-hour deadline "totally unreasonable" and said that the judge improperly substituted his judgement for that of the Secretary of Labor in deciding the number of foreign workers required.

Marshall said the order "undermines my fundamental responsibility to approve the importation of temporary foreign workers only when domestic workers are unavailable."

Turks's action came with President Carter already under heavy fire from labor union and black leaders for failing to protect the interests of the American workers and minority groups who voted so heavily for him.

The administration also is attempting to move through Congress a controversail an complex plan dealing with illegal immigrants, but the people imported to work temporily during harvests are here legally.

One official said the department would seek a new hearing before Turk and attempt to show that his decision was wrong. He said the department will, if necessary, fight the order in the court of Appeals and in the U.S. Supreme Court.

The Labor Department said that last year the importation of 3,431 foreign workers was approved but the growers brought in only 2,946. "Now Judge Turk wants us to approve the creditation of about 2,000 more workers than were imported last year even though a greater number of workers are available domestically," Marshall said.

Apple grower Robinson countered that the crop last year was very poor and that fewer workers were needed. He said that as domestic workers are found the need for foreigners will drop and that the full number allowed probably will never be hired.

He complained that last year many of the Puerto Rican workers brought in by the Labor Department were "children out of cities - city kids who were undernourished, couldn't pick up a ladder and didn't know what they were supposed to do."

Partially because of that experience, East Coast growers associations arranged with the Jamaican government, a major source of pickers, to pay for transportation costs after worker had been on the job for two weeks. Traditionally, the growers had paid transportaion costs in advance.

A Labor Department official acknowledged that the growers had legitimate camplaints about the way the recruitment program worked last year.

"I can see their side. Jamaicans are hard, good workers and they need the money as much as anyone," the official said, "but that is in conflict with our legislative mandate, which is to give jobs to mainland and Puerto Rican workers first. They could be trained into very good workers, too."