James Montgomery put together an allegorical stop-motion animation which impressed the judging panel last month.
The award, administered by UCAS and the Times newspaper, is open to thousands of university across the UK.
James (19) is a former pupil of Millersneuk Primary and is currently in the first year of his computer science degree at St Andrew’s University.
He hopes his win might inspire others to pursue a career in computer science.
“I still can’t believe it,” he said. “It’s nice to have some recognition for your work.
“It’s first award I have won in this field so it is very encouraging.”
James’ video features an onion being sliced and then reforming to represent the splitting of problems into manageable layers within the world of programming.
He explained: “Sometimes you’ve got to think about billions of transistors switching billions of times a second.
“And other times you need to move up to a higher level of understanding and focus on creating an amazing program.”
James was originally on his way to career in music but a late change of heart turned his attention to computer science.
He said: “I’ve always been interested in science but I just felt that computer science was a little more creative.
“That creative process is something which drew me to the field and it’s always rewarding to see the end product of a long-running project.”
James was also awarded £3,000 and will also be invited to spend a day at The Times office in London.