A U.S. judge here has rejected claims that he and his fellow judges on the federal bench in Maryland have violated the right to a fair and impartial jury by appointing mostly men as foremen of grand juries in the last seven years.

Judge Walter E. Black Jr. held that even though 42 of the last 50 grand juries have been headed by men appointed by the judges, the function of such foremen is largely administrative, with little or no additional influence over the actions of the grand jury.

Unlike foremen of state grand juries, who can issue subpoenas and help prosecutors in investigations, Black said a federal grand jury foreman is limited largely to swearing in witnesses, signing indictments and keeping a record of votes.

Because the role is "only minimally different" from that of rank-and-file members, Black said, the rights of a criminal suspect facing possible indictment is adequately protected, as long as the composition of the grand jury as a whole "is not the result of a discriminatory selection process." There is no "requisite statistical showing" of that, he said.

Federal grand juries, which range in size from 16 to 23 members, are selected at random from voter registration rolls, and have averaged 48 percent women in Maryland over the last 10 years, said Black, quoting from a statistical survey. Even though women made up 52 percent of registered voters in the state in 1980, the most recent presidential election year, he said that represents "an absolute disparity of only 4 percent," which "translates into a difference of less than one grand juror on each grand jury."

The ruling by Black, one of eight judges on the all-male federal bench here, came in the case of James J. Donohue III, a Great Falls, Va., businessman indicted in June 1982 on tax evasion and obstruction of justice charges. He is scheduled to plead guilty to one or more of the charges Friday.

In a pretrial motion to dismiss the indictment, Donohue's attorneys contended that federal court rules empowering judges to appoint grand jury foremen lacked objective criteria, and a survey they conducted showed the judges overwhelmingly preferred men to women in their appointments--42 to 8 in the last 50 grand juries.

A touch of irony has not gone unnoticed by attorneys in the Donohue case: Both the foreman of the particular grand jury that indicted Donohue and the assistant U.S. attorney who prosecuted him are women.