Jacqueline Kennedy, left, and her Cape Cod neighbor Bunny Mellon at the theater in 1961. (AP)

The love-child-and-mistress scandal that brought down onetime vice-presidential candidate John Edwards might have gone very differently if not for an encounter years earlier between then-first lady Hillary Clinton and Bunny Mellon, the socialite and philanthropist who designed the White House Rose Garden for John F. Kennedy.

In a new book out Tuesday on Mellon, who became Edwards’s biggest backer and whose infamous “Bunny money” Edwards illegally funneled to cover up the affair, author Meryl Gordon traces bad blood between Clinton and Mellon to a 1994 meeting at the White House. “Bunny thought the then-first lady had not been suitably appreciative of the Rose Garden,” Gordon wrote, according to an excerpt. From then on, “she referred to Hillary as ‘the old rag’ and ‘the elf.’ ”

If only Clinton had stopped and smelled those roses … According to the new book, Mellon — the heiress to the Listerine fortune who became a style icon and art collector — was so miffed at Clinton’s perceived dis that she threw support behind Edwards in the Democratic presidential primary.

Animosity wasn’t her only motivation, though, Gordon writes. Edwards’s initial visit to her Upperville, Va., mansion in 2005 gave the Kennedy confidante shades of Camelot. “It brings back the excitement of the day John Kennedy walked into the house, before he was elected president,” Mellon wrote at the time to Bryan Huffman, her friend and decorator who would later help her pass checks to Edwards, according to the new book.

Edwards would eventually be indicted on six charges of breaking campaign-finance laws relating to misuse of funds to cover up his affair and child with a campaign videographer named Rielle Hunter, though the government dropped its case against him in 2011. Mellon, then more than 100 years old, still seemed enthralled by the excitement of it all.

“Bryan, just imagine, if we go to jail for this we could get cells next to each other and do them so attractively,” she wrote to her designer pal, as if discussing plans to redo a room in one of her fabulous homes. “Very spare, attractive, and warm, we could talk through the bars.”