The incident took place yesterday when the victim had gone to eat at 'a langhar', Inspector R S Sasthe told PTI.
The accused took the boy to an isolated place and sodomised him, and when he resisted, they set him on fire, the officer said.
The boy, who suffered 30 per cent burn injuries, somehow managed to escape, Sasthe said.
A case has been registered under sections 307 (attempt to murder), 377 (sodomy) of the Indian Penal Code and relevant sections of Protection of Children from Sexual Offences Act, 2012.