It's not clear whether his resignation was accepted and he was actually relieved.
If yes, he has to be paid gratuity for the entire service treating as 5 years. The post is also silent on this.
"Three months Contract basis" means Fixed Term Contract Employment the terms of terminal benefits of which are proportional to the length of actual service rendered and thus different from those of the preceding regular employment. This also would require the F&F settlement of dues to the employee for the services rendered as a regular employee by the same person.
Therefore, by accepting his resignation, relieving him formally and settling his dues arising from the regular service, you can reappoint the same employee on fixed term contract basis.
The above answer is India-specific only based on the Indian Laws pertaining to gratuity and fixed term contract employment.