The problem seems to be that he is refusing up front to do so and thus discriminatory. This won't be an easy legal battle and could have been set up more powerfully with a student who actually has vested a lot of time in his courses, but it has at least as much logical merit as the prof's position.
Had the student in question signed up for the class for credit, rather than sitting in on two classes and looking at a website, then had the professor either flunk him because the student believes in creationism, or, if he had gotten an A, refused to write a letter of recommendation based on the student's belief in creationism, the student would've had a leg to stand on.
Letters of recommendation are done on a voluntary basis by a professor. The professor can pick and choose whom he decides to write letters of recommendation. However, the student in question didn't even reach that threshold. He didn't take the class. I can't see where he's been actually harmed.
This is frivilious litigation.