Avinash Shete, a resident of Nevase in Ahmednagar district, was apparently upset over failing to clear the Maharashtra Public Service Commission (MPSC) examination.
He poured kerosene on himself in front of a gate of the Mantralaya following which he was detained, he said.
Mr Shete had taken the MPSC examination in 2013 for the post of an assistant in the agriculture department but failed to clear the test, he said.
Since then, he used to frequently come to the agriculture department in Mantralaya to meet officials while claiming that he had written all the answers in his exam paper and was quite sure of clearing it, the police official said.
This morning, Mr Shete again came to the secretariat and poured kerosene on himself outside the Garden Gate around 11.30 am. However, the police caught hold of him before he could immolate himself, he said.
The police recovered a can of kerosene and a matchbox from him, he added.