Karl Henderson, 17, described as the "most talented musician" his school has ever seen, molested the girl, at a Stirlingshire high school in January last year.
Despite pleading guilty to the charge on indictment, Henderson, who was 16 at the time of the assault, told police it was "consensual".
Sheriff John Mundy took what he called the "exceptional" step of handing Henderson an absolute discharge, saying he found it hard to determine "what actually happened".
Henderson, of Fankerton, Denny, Stirlingshire, pleaded guilty to a charge that he did sexually assault the girl and prevent her from leaving a cupboard. Sheriff Mundy told him: "I think it's an exceptional case."