The incident took place under Masuri town police station area and family members of the deceased have identified the assailants, the police said.
Senior Superintendent of Police or SSP Vaibhav Krishna said Mahendra, a Dalit, was returning to his home this evening after parking the vehicle on a private school premises.
When he was just a few yards away from his home, the five bike-borne assailants opened fire at him, leaving him dead on the spot, and fled, Mr Krishna said.
Anil, the brother of Mahendra, told police that on February 12, 2009 their father Sahib Ram, a labourer, was shot dead during the wedding procession of his brother.
The "higher caste" people of the village were opposing the procession, the official said, adding that the murder case of the father is still under trial in a district court.
A few days ago they had allegedly threatened Mahendra not to give evidence in his father's murder case.
The body has been sent for postmortem and an FIR is yet to be filed, Mr Krishna said.
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.