First of all, even if it is not allowed to test them, you can also refuse to service someone untested - and that is not illegal discrimination, as "untested for COVID 19" is not a protected class.
Public Schools however are not companies in the normal way, and the CDC can only advise in the rulemaking of local legislators and executives. And in the current health crisis, the school board and health authorities can order things for the protection of others and this can be enough justification to exclude individuals or several people from groups. After all, being teste or not is clearly not a protected class under the Civil Rights Act, and neither is easily regarded as a form of first amendment speech - unlike a black armband (Tinker v. Des Moines Independent Community). Being untested is much more akin to being a person on a ship and then attempting to disembark in a quarantine zone - which was decided in Compagnie Francaise & Lousiana Board of Health (there are two of those btw). The majority opinion in the SCOTUS case (1902) writes (emphasis mine):
24 True it is that, in some of the cases relied on in the argument, it was held that a state law absolutely prohibiting the introduction, under all circumstances, of objects actually affected with [a contagious] disease, was valid because such objects were not legitimate commerce. But this implies no limitation on the power to regulate by health laws the subjects of legitimate commerce.
34 [A]ssuming that all the treaties relied on are applicable, we think it clearly results from their context that they were not intended to, and did not, deprive the government of the United States of those powers necessarily inhering in it and essential to the health and safety of its people.
Using a similar vein as in Compagnie Francaise, the public health interest might be enough for even a public school to only allow presence in the building with a test and otherwise demand online or remote learning (which isn't always an option) or even just suspend people that are not tested until such a time their presence is deemed safe.
A private school is vastly more free in rulemaking, and as even a public school can muster strict scrutiny regarding presence teaching, a private school surely will get away with it. But nothing can force a private school to suspend teaching, switching to online classes or demand to test, unless they like to or their accreditation hinges on it - and here religious schools come in: There are religious groups that to an extent of not allowing medical procedures on their members, including COVID-testing. Those schools could ban people from attending that are tested.
Endnote
Public Health Interest is a hammer that can be rather heavy. It can't be used to discriminate against HIV, as that doesn't spread from touch and sneeze, but it can be used to ban people from buildings that have Communicable Diseases. While nobody classed COVID 19 as such yet, having such an illness [Plague, Cholera, Botulism, and others] allows the government to isolate you under strict scrutiny or even has been used to quarantine whole areas in the past (see the Compagnie Francaise case). And as you see in the current pandemic, legislative bodies globally do dish out rules for schools and public places in short order, some of which include testing strategies, and ways to overwrite consent via a state order. Some are struck down: some of them on procedural grounds (e.g. wrong body), others on grounds of equality (e.g. religious bias).