The ruling clears the way for James Holmes' arraignment, and Holmes is expected to enter a plea when he appears in court Tuesday, The Denver Post reported.
Under the state law, defendants entering pleas of not guilty by reason of insanity must agree to a psychiatric evaluation. Holmes' lawyers argued that violated the constitutional right to avoid self-incrimination.
Holmes allegedly killed 12 people and wounded 58 at a midnight showing of "The Dark Knight Rises." He has been charged with 166 counts of murder, attempted murder and other crimes.
Defense lawyers submitted five motions last week, including one arguing the law makes them unable to provide effective legal counsel.
"Counsel's ability to ferret out the issues and inconsistencies in the statutes dispels any concerns at this point in time regarding the competence and effectiveness of counsel's assistance of defendant in this case," 18th District Chief Judge William Sylvester wrote.
Holmes, a former University of Colorado graduate student, could face the death penalty if he is found guilty, although prosecutors have not said whether they will seek it.