BELOVED actress VALERIE HARPER didn’t listen to her dear friend MARY TYLER MOORE – and it might have cost the former “Rhoda” star her life!

Mary, 76, was recovering from delicate brain surgery in 2011 when she urged Valerie to get a complete medical checkup, in­siders say. Sadly, the 72-year-old actress brushed her off – and now, she recently revealed she’s suffer­ing from inoperable brain cancer and doctors give her just three to six months to live.

“Mary  wasrecovering after a benign tumor had been removed from the lin­ing of her brain when she told Valerie to get repeated checkups,” said a source.

“She was especially concerned because Val had said that she was having severe headaches and just didn’t feel right.”

Even though Valerie had suc­cessfully battled lung cancer in 2009, she ignored Mary’s warning to get a brain scan, said the source.

“Now, ironically, Val’s terminal brain cancer is in the same region of the brain where Mary’s tumor was,” said the source. “If Val had fol­lowed Mary’s advice, she probably wouldn’t be doomed to die.”

The two women have been close since Valerie played the role of Mary’s sassy neighbor Rhoda Mor­genstern on the iconic ’70s sitcom, the “Mary Tyler Moore” show.

Val went on to star in the spin-off, “Rhoda,” and later played a suburban mom on the ’80s show “Valerie.” Over the years, she scored eight Emmy nominations and won the prestigious award four times.

She revealed on Feb. 6 that she’d been diagnosed with terminal brain cancer on Jan. 15 after her face went numb.

It’s a rare form of the dis­ease called leptomeningeal carcinomatosis, and experts believe it may have been trig­gered by her previous battle with lung cancer.

Doctors first told Valerie’s hus­band Tony Cacciotti of the deadly diagnosis, and after he relayed the bad news to her, “Mary was the first person Val told about it,” said the source. “Now, despite her own many health problems from years of battling diabetes, Mary is doing what she can to make Val’s remain­ing days as joy-filled as possible.”