WHEN BARBRA WALTERS got wind of ABC’s secret plan to dump her in favor of her rival DIANE SAWYER, she declared: “You can’t replace me – I’m retiring!”

That’s what sources are saying was really behind the news legend’s May 13 announcement that she’s going to call it quits in the summer of 2014.

“Barbara was fit to be tied when she found out that network execs wanted Diane to take her place,” said a source. “The two have had a rift for years as each tried to poach the other’s exclusive interviews.”

While BARBARA, 83, heads toward the door, Diane, 67, has been on a roll.

Ratings are up for her “ABC World News,” and her April 30 inter­view with Amanda Knox – the American beauty imprisoned in Italy for four years – was a bona fide blockbuster.

Despite Diane’s recent triumphs, “the network realizes she has been working at a furious pace and cannot keep it up forever,” revealed an insider. “The idea is to have her do all the celebrity interviews for ‘The View’ and for Barbara’s annual ‘Ten Most Fasci­nating People.’”

As The ENQUIRER reported in early March, the original plan was to have Maria Shriver replace Walters, but that idea crumbled when Shriver, 57, took a new job at NBC as a “special anchor.”

“Now all systems are go for Diane to take over for Barbara,” said the source.

“Seeing how the two have been feuding for decades, it’s going to be sweet revenge for Diane!”