The play is written by ex-Busted member James Bourne and theatre composer Elliot Davis. It is based on a number of songs by Bourne's second band Son of Dork.
"To my ears, the songs were like compact, three-minute dramas," Davis told The Guardian. "I heard all these characters and narratives and said, 'Have you ever considered turning this into a musical?'"
Bourne explained: "It was never really in my sights. But I was at a crossroads with my career. My band had split up, we'd been dropped by the label. And I just wasn't ready for that at all. I still felt hungry.
"One thing I knew for certain was that it wouldn't be a thrown-together, jukebox musical. If a song on the album didn't fit the storyline, we ditched it. In the end, we wrote about 50% new material."
Loserville is set in an American high school computer room in the 1970s, dubbed "an oasis for the ridiculed and socially retarded". Lead character Michael Dork has a dream of creating computers that talk to each other, before the invention of email.
EastEnders actor Aaron Sidwell and singer Lil' Chris also star in the musical, while Gates plays an arrogant jock bully.
Gates stated: "Loserville's director Steven Dexter gave me my first ever job, at the age of five, in a production of The King and I at Bradford Alhambra. Being back in Yorkshire is just great. I've been living back at home. My mum makes me a packed lunch every day."
Loserville opens at the West Yorkshire Playhouse in Leeds tomorrow (18 June). It will run until Saturday, July 14, with tickets available now.