General Prayut placed a bouquet of flowers in front of the nursery gate in Na Klang district where the tragedy occurred on Thursday. Other Cabinet members followed suit.
Thirty-eight people, including 24 young children, were killed by a 34-year-old former police officer, Panya Khamrab. Ten others were injured in the attack, which involved a gun and knife.
The prime minister and his Cabinet members also went to the Uthai Sawan Tambon Administrative Organisation, where grieving family members of the victims were gathering.
Prayut expressed his condolences in person and offered them his moral support for their loss.