The prime minister, who was under pressure from months of street protests, was accused of a conflict of interest because he remained in military housing despite his retirement from the army in 2014, months after overthrowing an elected government.
The nine-member constitutional court, however, unanimously ruled in his favor on Wednesday.
The head judge said the military had changed the status of the residence from an army house to a guest house in 2012, "so, technically, the defendant's no longer living inside an army house."
The "not guilty" verdict for the prime minister also means that he can stay in power.
"The status of General Prayut Chan-o-cha as prime minister and defense minister remains unchanged," the judge said.