The incident took place in Lakhimpur Kheri district Tuesday, police said.
Constable died on his way to the trauma centre
When homeguard Ram Murti was moving ahead with the criminals, someone threw red chilli powder into his eyes and shot at constable Virendra Pratap.
The assailants then fled the scene with the two accused, Bagga Singh and Mohammad.
Police said the constable died on his way to the trauma centre in Lucknow. A manhunt has been launched to nab the criminals.
Bagga was serving a life term in a rape case and was to appear before the court in a case of extortion. The other man was booked for seeking dowry and harassing his wife.