“It was agreed, before a child was conceived, that [the Maranos and Garcia] would all raise the child together as parents,” the judge said.

Dawn Marano’s insurance covered Garcia’s pregnancy, and the two women attended doctor appointments together, the papers say. They also took turns getting up in the night to feed the baby.

The threesome was one big happy family for 18 months until Garcia and Dawn Marano decided to become a twosome. They moved out and into a new home in nearby Central Islip in 2008.

Then Michael Marano sued Garcia for custody of their son. Dawn Marano then sued her husband for divorce.

Michael Marano and Garcia agreed to joint custody, but Dawn felt left out. As neither a biological nor adoptive mom to the boy, she had no automatic legal right to custody.

Although she still lives with Garcia, Dawn Marano filed another suit “to secure custody rights for [the boy] because she fears that without court-ordered visitation and shared custody, her ability to remain in [the boy’s] life would be solely dependent upon obtaining the consent of either Audria or [Michael],” Judge Leis explained.

Michael Marano opposed his ex-wife’s custody bid and the case went to trial.

Leis chastised him in the ruling Wednesday, noting that no one had told the dad “to conceive a child with his wife’s best friend.”

In awarding Dawn Marano shared custody, Leis cited a ruling by the state’s highest court last summer that allowed nonbiological or adoptive parents to seek custody of a child if they had a prior relationship with that child.

The judge took cues from the boy himself in making the unusual decision.

Asked how he told his two moms apart, the child had explained that one was the “mommy with the orange truck” and the other the “mommy with the gray truck.”

Leis concluded the boy knows the “two women as his mother.”

He also credited all three parents with raising their son “in a loving environment.”

Leis granted Dawn Marano Wednesday nights with the boy, as well as one week of vacation during the school year and two weeks in the summer.

Garcia has residential custody, while Michael Marano gets the boy on the weekends.