We analyze the problem of choosing the optimal order of hidden Markov model for recognizing functional gene fragments. We propose four statistical criteria to determine the optimal order, which are based on likelihood ratio test, ergodicity, Markov property, and Akaike's information criterion. Additionally, we confirm the efficiency of Bayesian mixtures of Markov models for solving the problem in question and determine the optimal mixture size using statistical criteria.