You never know what you’ll get with divas Nicki Minaj and Mariah Carey — and that’s what “American Idol’’ execs might be counting on to boost stagnant ratings.

“Idol” producers yesterday announced they were adding hip-hop star Minaj and country star Keith Urban to the lineup of judges, joining new panelist Carey and show stalwart Randy Jackson.

Considering Minaj and Carey’s past prima-donna behavior, old-timer Jackson and mellow Urban are sure to be called on to keep the peace.

The Fox talent show, which relaunches in January, had already announced Carey would be a judge. She, Minaj and Urban replace two former judges — Jennifer Lopez and Steven Tyler.

Jackson is the only original judge from the show’s debut 11 years ago, but for months, it seemed a forgone conclusion that he wouldn’t be back for Season 12.

As recently as last month, reports had producers pushing him out as part of an effort to freshen up the aging show.

But “Idol” evidently decided to keep the veteran music producer as a link to past glory days — and to help referee potential friction between Minaj, who’ll earn $12 million, and Carey, who’ll take home $18 million.

The Minaj-Carey matchup follows the proven formula of mixing oil and water — à la former judges Paula Abdul and Simon Cowell — to stir up ratings.

On Minaj’s draw, Mike Darnell, Fox’s head of alternative entertainment, said, “Nicki’s an unbelievably captivating international phenomenon who has made an indelible mark on rap and pop.’’

Of Urban, he added, “I know that our fans and contestants will fall in love with him.”

Execs apparently hope to increase the show’s “hip” factor with the new judges.

While Abdul, Lopez and Tyler were popular, their biggest record-selling days were already behind them when they joined “Idol,” unlike the new judges.

The new trio also could signal a bid by “Idol” to freshen up the song selection it offers contestants to choose from.

The show has long been knocked for its oldies taste, which includes hits from Motown and the Beatles’ songbook.

“Idol” remains one of TV’s most popular shows, but its total audience has been slipping for years.

The show’s all-time-high season finale came in Season 2, with the Ruben Studdard-Clay Aiken matchup.