Does there exist a complexity class such that the number of accepting paths is a prime number?
Many other complexity classes which have appeared in literature are defined in terms of the number of accepting paths.  Just for fun, examples from the Complexity Zoo include GapP, AWPP, C=P, Few, FewP, LWPP, ModkP, SPP and WPP.  Also do not forget the logarithmic-space versions of these classes.

A serious fact is that the definition of randomized complexity classes such as the very important BPP can be viewed as based on the number of accepting paths.

As for the class of decision problems which have a nondeterministic polynomial-time Turing machine such that yes-instances have a prime number of accepting paths and no-instances have a composite number of accepting paths: As Philip White and other people wrote in comments on the question, you could define it.  Whether that class has any interesting property or not is a separate issue.