BALTIMORE, JULY 30 -- In what he called a foray into new legal "frontiers," a federal judge has ruled unconstitutional a Maryland Democratic Party requirement that party members vote for an equal number of men and women as delegates to the party's national conventions.

The ruling could disrupt Maryland's plans for its presidential primary just seven months away, party attorneys said, and also could affect primaries in at least four other states whose rules are similar to Maryland's. Legal scholars said it is highly unusual for a judge to intervene in party politics, particularly because such intervention has been frowned upon by the U.S. Supreme Court.

In his ruling issued Wednesday, U.S. District Judge Walter E. Black Jr. said the Maryland party rule "unduly infringes on {the voter's} fundamental right to vote by instructing a voter how to allocate his votes."

"Just as a state can no longer encourage voters to cast ballots on the basis of race . . . so, too, a state cannot explicitly encourage and require voting on the basis of gender," the judge said.

Representatives of the Democratic National Committee and the state Democratic Party said they were studying a possible appeal of the 58-page ruling. One attorney said the party also could abandon the practice on an interim basis for the March 1988 primary, if an appeal cannot be resolved by then. Legal experts said that because it is unusual for a judge to decide internal party politics, the decision faces an uncertain future on appeal.

Agreeing that Black has ventured onto new legal ground, lawyer John Willis, chairman of the state party's delegate selection committee, said the ruling also could affect the status of four other states that have direct elections of convention delegates similar to Maryland's.

In the other 45 states, delegates are chosen at party caucuses or are selected on the basis of the percentage of the popular vote won by each candidate in a presidential preference primary.

In contrast, Maryland, under the national Democratic Party's "equal division rule" requiring an even number of male and female convention delegates from each state, lists its convention candidates by name on the ballot, along with the name of the presidential candidate to whom they are pledged.

In addition, the names are listed in columns separated by sex, and voters are instructed to vote for an equal number of women and men.

The other four states planning similar ballots for the March 1988 primary are Illinois, Pennsylvania, New Jersey and West Virginia. They control 16 percent of the 3,517 elected convention members, Willis said, "a not insignificant number, I would say."

National and party leaders said it was unclear whether other states would be affected by the decision.

Black's ruling grew out of a suit filed in May 1984 by Nicholas R. Bachur Sr., 54, a suburban Baltimore resident and deputy director of the University of Maryland Cancer Center. Protesting the 50-50 male-female voting requirement, Bachur directed the suit against both the national and state Democratic parties, as well as state elections officials.

Black's ruling Wednesday was issued more than two years after attorneys presented their final arguments in June 1985, leaving some state Democratic Party officials miffed at the delay. Several said the ruling, and any appeal of it, could disrupt plans for the upcoming primary, only seven months away.

"It does pose some pragmatic problems," Willis said. He said the state party has already received provisional approval of its delegate selection plan from the national party, but those plans now may have to change.

In his ruling, Black said the case presented tough questions in balancing the "right of a citizen to vote unencumbered" with the "the right of a major political party independently to determine its delegate selection process."

Black praised the national Democratic Party's equal division policy as a means to overcome historic exclusion of women from the political process. "Clearly the problem, of underrepresentation of women . . . constitutes an interest to be weighed . . . . But the interest is not compelling enough to override the voter's fundamental right," he said.

Careful not to say the national party's equal division policy is itself legally flawed, Black said only that Maryland's implementation of it was unconstitutional. He noted that there are "less restrictive means to accomplish the party's goal . . . for example, the party can appoint all delegates to the convention, the party can decree that delegates will be selected in caucuses, or the party can mandate that no primaries be held."

Rosalie A. Reilly, chairwoman of the Maryland State Democratic Party, voiced "great disappointment" at the ruling, saying party workers, including many volunteers, had been working feverishly in recent weeks on the delegate selection plan.

"They all worked so hard," she said, "and now this."