“In the great green room/there was a telephone/and a red balloon/and a picture of a cow jumping over the moon . . .”

For childhood readers of the classic “Goodnight Moon,” there is no more nostalgic image. The simple, rhythmic language and the bold drawings captured the hearts and minds of the public when “Goodnight Moon” was published in 1947. It has sold over 14 million copies and is one of the most beloved children’s books of all time.

But it’s likely few could even name the book’s author, let alone know her wild backstory. She was a hyper-prolific writer who changed the face of modern picture books; a children’s book author who didn’t particularly like children; an avid rabbit hunter who penned the classic story “The Runaway Bunny”; a great beauty who never married but flitted from relationship to relationship with men and at least one woman.

Margaret Wise Brown is the deserving subject of a new biography “In the Great Green Room” by Amy Gary, a Brown-obsessive, who unearthed a treasure trove of her unpublished works, diaries and letters and has devoted her career to continuing Brown’s.

Born in Brooklyn in 1910 and raised on Long Island, Brown came from wealthy but distracted parents who bickered and largely ignored their three children. Brown spent her youth in boarding schools, holding on to a vague aspiration to become America’s next great novelist.

When she graduated from college, Brown worked at the Greenwich Village progressive Bank Street Cooperative School, which sought a more child-centric approach to teaching. Here, Brown discovered her gift for engaging children under the age of 5 with her prose. She contributed to the school’s textbooks and published stories under the school’s literary arm. Soon after she sold her first manuscript to a major publisher.

‘I am stuck in my childhood, and that raises the devil when one wants to move on.’

The ideas came quickly. “The Runaway Bunny,” for example, popped in Brown’s head while she was skiing — she wrote the whole story, start to finish, on her ski receipt. Perhaps because it all came so easily, she spent her money with an almost pathological frivolity. She bought the entire contents of a flower cart with her first advance check and sold full rights to a story to buy a gray fox coat.

Despite her growing success, she harbored a deep insecurity about her career and wished to write “real” literature.

“I hope to write something serious one day as soon as I have something to say. But I am stuck in my childhood, and that raises the devil when one wants to move on,” she said.

And like many of the great children’s authors (Roald Dahl and Maurice Sendak come to mind), she had a conflicted relationship with her young fans. She told a Life reporter in 1946, “I don’t especially like children . . . At least not as a group. I won’t let anybody get away with anything just because he’s little.”

Brown never married or had children and didn’t seem to bemoan that fact. In a letter to her college alumni newspaper in 1945, she wrote derisively: “How many children have you? I have 50 books.”

Work never seemed to interfere with a lively love life. She had a long-term affair with a married man — who introduced her to one of his lovers, a socialite turned feminist poet 20 years her senior called Blanche Oelrichs, but who went by the name Michael Strange. Strange was a tabloid fixture famous for marrying actor John Barrymore and penning a book of erotic poetry about him. Brown was smitten.

The two loved as passionately as they fought. Strange was moody, and Brown was needy. Strange considered herself an intellectual, while Brown had a “frivolous” career as a children’s book author.

Oh, and Strange was married. Needless to say, carrying on a lesbian affair at a time when that fact could get you committed to a mental hospital was dangerous. But, for Brown and Strange, it was a risk worth taking. The two women moved in to the Upper East Side’s 10 Gracie Square together and lived in a state of bliss — at least until their next row.

During one breakup, as Brown recuperated from a broken heart and a surgical operation at her house in Maine that she lovingly referred to as “The Only House,” she wrote a poem about a girl who moved from the country to the city and to soothe herself imagined her old room. The poem became “Goodnight Room.”

Years later, while back in Strange’s arms, the poem returned to her in a dream along with images of her downstairs neighbor’s apartment — its bright green walls, red furniture with yellow trim.

The result was “Goodnight Moon,” which initially published to positive press and moderate sales. In 1953, 1,500 copies were sold — today it’s 800,000 copies a year.

Two months after the publication of “Goodnight Moon,” Strange collapsed at the Savoy Hotel. Told it was due to exhaustion (Strange was on the road with her show pairing great works of literature with music), she learned in 1948 that she was suffering from leukemia. Strange attributed her bad lot to her sinful behavior with Brown, and the two broke up again.

But, when Strange’s health deteriorated to the point that she needed to be hospitalized, she called upon her former lover. Standing vigil outside Strange’s hospital room, Brown heard her ex call out for only one name: Margaret.

Before Strange’s death, Margaret promised that she would memorialize her in writing. In one diary entry — a rare quote in this book that uses far too few of Brown’s words — she wrote of her lover: “One who has dared to be gloriously good and gloriously bad in one life. No limbo for her.”

Brown got one more chance of love — two years after Strange’s death, she dated a man 16 years her junior named James “Pebble” Rockefeller. Soon he proposed.

But it was not meant to be. While on a book tour in France, Brown suffered from appendicitis and underwent routine surgery. Her doctors ordered her to remain on bed rest. As she lay there, a blood clot formed in her leg, and when nurses asked if she was ready for discharge, Brown kicked off her sheets with characteristic enthusiasm, prompting the blood clot to move from her leg to her heart. She died that day at the age of 42.

Though she may not have found long-lasting love in her lifetime, it’s certain that she found it in death — with her legions of fans, including her biographer Amy Gary.

“She showed me how to live with awe and to love with abandon,” Gary writes. “For that, I am especially grateful.”