One of the accused - Tareef - is an employee at a factory run by the boy's father, while the other accused - Danish - used to work there, a senior police officer said.
The boy and his sister were on their way back home in Kardampuri from school when he was kidnapped on Monday.
The accused asked the boy about his uncle's address and then took him away, the police officer said.
The two accused have revealed that Mohsin, the boy's cousin, was the alleged mastermind behind the kidnapping, the officer added.
More details are awaited.
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections.