District Judge D. Dortch Warriner ordered the Justice Department today to continue giving federal aid to the Virginia State Police even though he conceded that the force has an "admittedly" poor record of recruiting blacks and women.

Warriner's action and sharply critical comments he made during a one-hour hearing here represented a major setback to the Justice Department, which has accused the state's 1,109 member state police force of discriminating against blacks and women in its hiring and personnel practices. State attorneys said today there were only 20 blacks and one woman trooper on the force despite intensive efforts to hire more minority employees.

Justice Department lawyer Stephen Koplan had barely told reporters after the hearing that he and his superiors would consider whether to appeal Warriner's decision when he was upbraided by Virginia Attorney General Anthony F. Troy. "Let's quit trying it in the press!" Troy snapped at Koplan as he left the courtroom.

Warriner had also left the courtroom by that time and Troy, who was recently elected to his position by the General Assembly, refused later to elaborate on his remarks. "This is the most sordid case in the history of the Department of Justice" was all he would say.

Inside the courtroom, the charges by D. Patrick Lacy Jr., one of Troy's deputies, were just as pointed, and they appeared to win Warriner's sympathy. At one point the judge said his ruling today would indicate whether he believes the department's initial discrimination suit against the state police force was "clearly meritorious at the outset."

Later, Warriner flatly sided with Virginia officials and said he would not order any hiring "goals" to be established for the Virginia police force.

Despite the small number of blacks and women on the force, Warriner said, "I see no indication on the part of the commonwealth that it is, to use an old expression, massively resisting or even passively resisting" efforts to hire more blacks and women.

Citing two recent U.S. Supreme Court decisions, Warriner said the Justice Department could not prove its case with mere percentage figures of blacks and women on the Virginia force. The department must show some purposeful, deliberate" effort on the part of state officials to exclude them from the force, he said.

Although the amount of federal aid in question in the hearing was relatively small, about $400,000 this year, Lacy argued that the state should not be penalized because its efforts to hire more blacks and women were sincere - a point disputed by Koplan.

Under the Crime Control Act of 1973 such aid is automatically cut off from a state 45 days after it is sued on grounds of racial or sex discrimination.

Virginia officials had appealed to Warriner to block the cutoff, claiming today that the lawsuit was the result of what Lacy described as "some bizarre circumstances" taken by "subordinates" in the Justice Department who were insisting that the state sign a consent decree spelling out "quotas" for blacks and women on the force.

Koplan contended that the proposed consent decree mentioned only "goals" for minority employment, but Warriner said the "goals" were nothing more than "quotas" and that he would have no part of them.