Online classes for prerequisites aren’t allowed for dental school. Find out if it states they're online courses through the institution and if it will show up on the transcript.
Not sure how schools might feel about you taking the classes elsewhere. But dental schools will have some sort of system of identifying if schools are more glad inflating or deflating and adjust accordingly I would presume. I could be wrong but it seems logical.
But schools should understand that costs is a big deal for education. So they may think you were just trying to save time/money. But first find out if the courses state their online on the transcript and work from there
Be warned, pretty sure you will need physics with Lab, not sure you can take a lab course online and most schools will probably require both physics 1&2 with lab. So I would do a little research before committing to taking these classes. Most dental schools don't require anatomy, but it's still a good class to take for preparation. Chem and BIo will also require lab as well with the courses. Are you a science major? You'll basically complete these courses during your degree, but if you think you'll save some time and money taking them elsewhere shouldn't hurt you as long as the classes meet the requirements. You could reach out to your school's prehealth center and ask.