Prosecutors said Hasanuddin plotted the attack to avenge the killing of Muslims at a boarding school by Christians in 2000.
They said Hasanuddin masterminded the attack but was not present when it was carried out.
Lilik Purnomo and Irwanto Irano, two other defendants, carried out the morning attack on Hasanuddin’s orders, the prosecution said.
Four girls were attacked on their way to school. One was wounded but managed to escape and reported what happened.
Prosecutors said neither Lilik nor Irwanto swung the machetes used to decapitate the girls but were assigned to co-ordinate and lead the ambush.
The other members of the seven-member group that carried out the attack are still at large.
Lilik and Irwanto will face charges of criminal conspiracy in a terrorist crime and premeditated murder.
All three defendants are being tried under Indonesia’s anti-terrorism laws and if found guilty could face death by firing squad.