I'd probably meet with the teacher ahead of time and ask how the teacher handles such students. If this class has been taught for a few years, the teacher almost assuredly has experience with a baseball know-it-all.

Here's what I do from the other side of the desk:

I teach a university class that attracts mostly students who just want to suffer through and get their gen ed credit, but always one student who has eaten, slept, and breathed the topic since early childhood.

It's hard to manage. I schedule my office hours to be immediately after this class.

At first, I label questions or comments that are beyond the scope of the class as such, and tell the student that I'm happy to answer the question after class. I only answer questions after calling on the student when his/her hand is raised. This helps me manage interruptions, and to put off the question so that it's less of a disruption. If I'd answered the question while the student was waiting with a raised hand, I simply state that I'd explained it while the hand was up.

I answer all other questions in my office hours first, then those that are beyond the scope of the class. I justify it as being a matter of responding to needs within the scope of the class first.

I give it 4 class periods. If the student isn't functioning appropriately, I pull the student aside and put the student on a question diet. I ration them to a certain number of questions per period, and I signal the total subtly to the student with my hand so the fact that this student is rationed isn't shared with the rest of the class.