Your assumption that in the times of moshiach there will be no more sin is unwarranted.
First of all, there is a machlokes in gemara (see shabbos 151) if there will be a yetzer hara when moshiach comes. According to Shmuel, there will be no difference between our times and the times of moshiach, aside from the fact that we won't be under someone else's rule. Indeed, the Rambam in sanhedrin (also in Yad Hachazaka) accepts Shmuel's view. According to this view, your question is moot.
Second, even according to the shitos that hold that the yetzer hara will be destroyed right when moshiach comes, it does not follow that a person will not be able to commit a sin. Indeed, even Adam Harishon was able to commit a sin, although there was no yetzer hara at that time. As the ramban and others explain, before Adam sinned, people had a natural inclination to do good; however, they still had the capacity to sin as Adam proved.
Lastly, even if people won't sin intentionally, they might still commit a sin unintentionally. Also as doubleAA already pointed out, the Sanhedrin not only decide if a punishment is required, but guide us in our ways, and tell us what is mutar and what is asur.