The dawg days are over at “American Idol” … TMZ has learned Randy Jackson is officially LEAVING the judge’s table … but will still remain a part of the show as a “mentor.”

Sources connected to “Idol” tell us … there’s some concern among the brass that Jackon is not well-suited for the mentor role … but they feel they need him because he’s the glue that helps keep the show together.

As for his replacement … sources tell us Nicki Minaj‘s deal is 99% done … but still not a sure thing just yet.

We’re told the honchos are keenly aware Mariah Carey isn’t a fan of Minaj and doesn’t want her at the table … a fact producers LOVE because they think the conflict and tension will be good for the show.

And … we now know A.I. will once again go with a 4th judge …  we’re told producers are gunning for someone from the country music world for the third seat.  Seat number 4 is up in the air.

Finally, altough “A.I.” wanted Diddy or Kanye West … we’re told they are definitely out of the picture.

Thiiiiiiiiis … is getting intense.

Source: www.tmz.com