An idea/suggestion

Emphasize the importance of the test. For example, a good score on the test allows him to access an honors level course or have a good score for college admission. ( If it’s not actually important… then it’s not actually important.)

Allow this kid regular time to explore the computer. He’s clearly interested in how computers work and how to make them work better.If he knows he can explore the computer regularly he is less likely to fiddle with it when he’s taking a test.