Until now, Simon Cowell has been successful in keeping details of X Factor: The Musical a closely guarded secret.

But I’ve learned details of the script — which is being written by comedian Harry Hill — and it is quite likely to offend current and former stars of the show.

The plot was unveiled to Cowell’s closest circle at a private afternoon read-through in London’s Soho last week.

Among the stars being targeted is Dermot O’Leary, the show’s presenter, whose character is portrayed as ‘pathetic and needy’.

There’s also a judge called Geordie, who spends most of her time sobbing into a Chelsea football jersey — a clear reference to former judge Cheryl Cole, who is from Newcastle and divorced from Chelsea ace Ashley Cole.

But former judges Sharon Osbourne and Dannii Minogue — an ex-flame of Cowell — do not feature at all and have been written out of X Factor history.

Instead the panel consists of actors playing Cowell and his pal Louis Walsh, as well as Geordie.

A source close to the production told me: “This is Simon’s pet project and he’s ecstatic with the script. He was in tears of laughter at the read-through.

“He knows how much trouble he’s going to cause. Dermot, Dannii, Cheryl and Sharon will all be furious for different reasons. This is his ultimate revenge - he doesn’t care who he offends.”

I’m also informed that Simon’s company Syco has pumped GBP10 million into the musical, which hopes to open in the West End. The story follows one contestant’s ‘journey’ on the ITV1 singing show. The character, called Shenise, is thought to be based on 2008 winner Alexandra Burke, although she will live in a caravan rather than a North London estate.

The storyline appears to be similar to the Spice Girls’ musical Viva Forever! which is based on a downtrodden contestant called Viva, who lives in a houseboat and competes in an X Factor-style talent show.

My source says: “Simon is confident his musical is going to be a huge hit. He hasn’t been this excited about a project for ages.”