Well, first of all, Gendry does not know that there are people looking for him.
He was being sent to The Wall because his master ordered him so, his master did this on request (and pay) by Varys. But Gendry does not know this truth.
He doesn't know there are people coming for him and he doesn't know that the helmet will identify him.
No one in the traveling party knows who he is, that the guards are looking for him or why they are looking for him. The only exception could be Yoren, who already knows that he has Eddard Stark's youngest daughter in his party.
Until the 2 guards arrive, there was no threat to Gendry.
After that Gendry probably did not think the guards would return because he thought the Nights Watch would keep him safe from the King's men and laws.
This fits Gendry's personality throughout the tv series as a young, naive and passive character who quickly feels safe when he shouldn't and trusts a lot.
- Gendry is raised and owned by his Master where he only works and stays
alive with no goals of his own.
- He follows the orders of his master to go to the Nights Watch, probably knowing that this would prevent him from having any sort of life of his own in the future.
- After being captured by the Guards, they are brought to Harrenhal. He knows he is wanted, altho thinks he is safe because Arya passed off Olly as Gendry to the Guards. After some torture he assigned to work as a blacksmith again and accepts this fate. No attempt to escape or rebel is made.
- After escaping with Arya they are found by the Brotherhood without Banners, they are interrogated in a friendly way, but once they find out who Arya is, they are captured and not allowed to leave. After this, he decides to stay with the Brotherhood to make arrowheads and steel because he feels useful there. In the end, they sell him to the Red Priestess.
- After being sold to the Red Priestess and transported to Storms End, he is offered food, a big bedroom and an interesting night with the Red Priestess. Again, he ends up being used and inside a jail cell until the Onion Knight saves him from certain death.
I cannot offer any solid facts or quotes on the matter.
Only my theory and observation of "he didn't consider dumping the helmet or even consider he was in great danger".