Denver Judge Elizabeth Starrs also ruled that any electors who fail to do so can immediately be replaced when the Electoral College convenes Dec. 19. She responded to a request from Colorado's secretary of state, who was seeking a way to prevent electors from diverging from the winner of the state's popular vote.
Electors Polly Baca and Robert Nemanich had sued to overturn a state law requiring them to vote for Clinton, but a federal judge refused to do so Monday.
There are similar lawsuits in California and Washington state seeking to overturn laws binding electors. A total of 28 other states have laws binding their electors to the winner of the popular vote.
At least one other Colorado elector has said he will vote for someone other than Clinton in a bid to woo Republican electors to a different GOP candidate, such as Mitt Romney. Only one Republican elector nationally has publicly said he would do that.
Chris Jackson of the Colorado attorney general's office argued in court Tuesday that the effort undermines democracy.
"What we're asking the court to do is protect against the chaos that would ensue from faithless electors failing to perform their state law duties," he said.
Jesse Witt, an attorney for Baca and Nemanich, said he was disappointed at Starrs' ruling and may appeal.
"We feel it is an abridgement of free speech and free expression," he said.
Earlier, Baca and Nemanich filed an emergency appeal to the 10th U.S. Circuit Court of Appeals to try to get it to suspend the Colorado law. That comes after U.S. District Judge Wiley Daniel declined to put the law on hold Monday and called the effort "a political stunt."
It's unclear whether the appeals court will hear the case before the electors vote, but the state judge's order would still stand.
The Colorado electors could face up to a year in jail and a $1,000 fine if they defy the law and vote for someone other than Clinton.
Trump won 306 electors last month, well over the 270 needed to put him in the White House.
Copyright 2016 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.