@murphy10 In the spirit of answering your question the way you asked it, it is possible for a 9th grader to take accredited AP classes during the summer through the John Hopkins CYT program: https://cty.jhu.edu/online/courses/advanced_placement/index.html A qualifying score on a standardized test, like the SAT, is required for registration.
But this is completely theoretical. As they say themselves, credit would have to come from the HS itself, and this will probably almost never be granted. Apart from that, this really would not be a good or reasonable plan for most rising 9th graders.