A Maryland appeals court has ruled that the state's judges may no longer automatically give preference to the mother in deciding which parent should have custody of a child in a divorce case.

The ruling of the Court of Special Appeals, Maryland's second highest tribunal, overturns the traditional judicial concept that, all other things being equal, a child is better off with the mother.

"A parent is no longer presumed to be clothed with or to lack a particular attribute merely because that parent is a male or female," the court declared.

The ruling overturning the concept called "maternal preference" is contained in a 10-page opinion issued Tuesday that notes that "the majority of jurisdictions (states) continue to follow the rule that the mother is the preferred party in matters of custody.

Courts in both Virginia and the District of Columbia have followed that rule, which is known in those jurisdictions as the "tender years presumption." In the District, a divorce law that went into effect last April could be used to challenge the rule, according to legal observers.

The case involves Joseph A. and Dorothy J. McAndrew, a Prince George's couple who separated in 1976 and subsequently found themselves battling in Circuit Court over custody of their young daughter. The issues in the case encompass deeply held beliefs, still widely cherished, in the unassailable virtue and primacy of motherhood.

Such beliefs, which the appellate court thrust aside, have even risen to the level of poetry, the court noted, in other judicial opinions: "The love, solicitude and devotion of a mother cannot be replaced by another," said a Nebraska tribunal.

As recently as 1972 a Maryland appeals court, upholding the "maternal preference" principle, found" the maternal tie . . . so primordial that it should not lightly be severed or attentiated."

That was in essence the conclusion reached by then Prince George's Circuit Judge James F. Couch, whose decision in "an even-steven situation" to award custody to the mother has now been overturned.

The wife, a school guidance counselor, took her daughter with her when she left her husband two years ago. A week later the husband retrieved the child from a babysitter and "secreted her in Pennsylvania," according to the appellate opinion.

Almost immediately thereafter the husband filed court papers seeking legal custody, and the wife also filed for custody. After a hearing in September 1976 a juvenile judge recommended paternal custody. At the trial before Couch last January, there were numerous witnesses and voluminous testimony.

Couch, who is now on the special appeals court and did not participate in this week's decision, was troubled by the case, calling it "the most difficult custody case I've been exposed to.

"Normally in these cases, we're able to analyze the evidence before us and find a bad situation on one side and a better situation on the other," he said. "Here, frankly, the court finds it very difficult to find anything significantly bad on either side."

The deciding factor, Couch finally held in his decision last May, had to be "the presumption in favor of the maternal side" recognized by the courts "when everything else is equal."

The courts had not always ruled that way, the appellate panel noted. Under early English common law, in fact, the father "had the absolute right to custody regardless of the child's welfare. So long as the father could provide discipline and support, colonial American courts upheld the same principle. It was not until the late 19th century, the appeals court noted, that courts and state legislatures began to take a contrary view.

Maryland courts repeatedly took a mother oriented view despite a 1929 law that "neither parent has any right superior to the right of the other concerning the child's custody."

Tipping the scales the other way, the special appeals court found, was a 1974 amendment to that law asserting specifically that "neither spouse shall be given preference because of sex in a court custody proceeding."

The "best interest of the child . . . may require a consideration of the biological and psychological differences between the parents," the appeals court said, only "to the extent that they bear upon their ability to provide the care needed by the child at the time."

The court disavowed, however, its 1974 decision in another case that "material preference" should be the "tie breaker" if everything else is equal. "There can be no tie breaker in a custody case because . . .there should never be a tie," the court said.