Is it legal for a woman who writes a religious blog to not allow men to access the site because of a belief that women should not teach men about religion?
That depends what is meant by "not allow".
Such a blog author could certainly include a statement that the blog was intended only for female readers. That would not be enforceable. She could include a ToS provision requiring a user to agree to such a restriction. That might be enforceable in theory, but it would be a lot of work to try to enforce, as a blog author does not normally know who her readers are.
Such an author could have the blog require registration and log-in, and as part of the registration process require registrants to provide evidence that they are females. That might work to keep (at least most) males from directly reading the blog.
If we suppose that the author had such a registration process, and someone brought suit under a federal or state anti-discrimination law, what would happen? Such laws usually only apply to "places of public accommodation". Such laws have mostly been employed to address discrimination in hotels, restaurants, theaters, retail stores, and similar places. I am not aware of any case declaring a blog or any similar online service a "public accommodation". Such a finding would be needed for a suit in such a case to be won by the plaintiff.
There are also specific laws prohibiting discrimination in employment, housing, and education. But those would not apply to this sort of case.
So I am inclined to doubt that any such restriction, if imposed by a blog author, would be found to violate US anti-discrimination law.
At least w.r.t. federal law, they can. Although there are laws against discrimination in public accommodations (Title II of the Civil Rights Act), sex is not a protected category. So we don't have to raise the question of whether a website is a "public accommodation". W.r.t. a different anti-discrimination law (ADA: title III), there is some legal murk over whether a public accommodation has to be a physical location, but so far websites have not been forced to comply with other anti-discrimination laws.
States may have their own anti-discrimination laws, but as far as I know, no state has attempted to regulate websites. All websites are "in interstate commerce", and one state cannot regulate commerce by another state, only the federal government can regulate interstate commerce.
Needless to say, a significant First Amendment issue would be at stake with such a law.