The 31-year-old rocker is to play a besotted partner to Harding's schoolgirl rebel character in his debut film role, The Mirror reports.
A source said: "The casting agents were looking for someone to play Sarah's boyfriend and they wanted a rocker. Ricky was perfect."
Wilson, who recently dismissed speculation that he was seeking a new career in TV, is long time friends with Girls Aloud and even performed tambourine on their ITV Christmas special in 2008.
St Trinian's, The Legend of Fritton's Gold is due in cinemas on December 18 and stars Rupert Everett, Colin Firth and David Tennant.