I am currently watching The Mandalorian and in an episode, it is mentioned that these bounty hunters never take their helmet off. So, how do they eat food, especially in public places?
A Mandalorian can take their helmet off when they are all by themselves.1 However, they cannot take their helmet off in front of someone else. If they do, they can't put it back. In episode 4 of the first season, the main character does take his helmet off.
and yes, the Mandalorian does remove his helmet to eat or when he’s by himself, but if he shows his face to someone, he can’t put it back on. Not literally, but he loses the privilege of putting it back on.
From Screenrant (emphasis mine),
About midway through The Mandalorian episode 4, "Sanctuary", the Mandalorian tells a young widow (Julia Jones) that he removed his helmet one day before. However, he hasn't removed his helmet in front of another person in decades - since the time he was taken in by the Mandalorians. As he tells her, "This is the way." Shortly after this conversation, the Mandalorian removes his helmet off-screen so that he can eat, but no one else is around to see his face. This solves a mystery about the main character and the Mandalorian culture but brings up another question.
So, it explains they don't really eat in public places.
1: Based on the observation till 4 episodes of the first season
They do, mostly in private, as seen with 'The Mandalorian' in episode 1.04 tiled, Sanctuary.
But just to add:
While these rules are important to Mandalorian culture and spiritual practices, they are rules that were not always followed.
During the series Star Wars: Rebels, a young Mandalorian named Sabine Wren was often shown with her helmet off and in front of others, including Ezra Bridger and Hera Syndulla.
However, it appears within the narrative of The Mandalorian, the Mandalorians are hidden underground on a planet that is not Mandalore, as it was stated they usually come to the surface one at time.
It's not perfectly clear what is going on here, but it seems the Mandalorians may be on the verge of going extinct and it may be one reason why "spiritual preservation" is being practiced more strictly...
1.03 - The Sin - Transcript:
The Armorer: It will draw many eyes. These were cast in an Imperial smelter. These are the spoils of the Great Purge. The reason that we live hidden like sand rats. Our secrecy is our survival. Our survival is our strength. Our strength was once in our numbers. Now we live in the shadows and only come above ground one at a time. Our world was shattered by the Empire, with whom this coward shares tables.
The Mandalorian: The Empire is no longer. And the Beskar has returned.
The Armorer: When one chooses to walk the Way of the Mandalore, you are both hunter and prey. How can one be a coward if one chooses this way of life? Have you ever removed your helmet?
The Mandalorian: No.
The Armorer: Has it ever been removed by others?
The Mandalorian: Never.
The Armorer: This is the Way.
It's also possible that main 'Mando' is too serious a character and feels he must follow every rule since the Mandalorian's took him in after his parents were killed. But in truth, this is a story of man who has to find out whom he really is, as The Child forces him to rethink everything!
In the episode The Sin, The Mando seems to walk a fine line between what the other Mandalorians would and would not accept, until he finally double crosses the Client and saves The Child, in which the Mnadalorians come to his rescue, but it may be there will be times where he will be at odds with his current cultural/spiritual beliefs.
Just wanted to provide a little update to my previous answer.
Part of season two's narrative is about contesting what a Mandalorian is and it's become a little clearer from episode 2.03 ("The Heiress") in particular, that Din Djarin belongs to cult of Mandalorians called "The Watch", who seek the old ancient ways, as other more previously mainstream Mandalorians attempt set him straight.
It doesn't explain if The Mandalorians are as extinct as they were previously made out to be, but it does go back to story elements and history featured in The Clone Wars and Rebels touching on previous Mandalorian civil wars, showing a history full of philosophical divisions.
2.03 - The Heiress - Transcript: (New Character Spoiler Warning!!!)
Bo-Katan Kryze: I am Bo-Katan of Clan Kryze. I was born on Mandalore and fought in the Purge. I am the last of my line. And you are a Child of the Watch.
Din Djarin: The Watch?
Bo-Katan Kryze: Children of the Watch are a cult of religious zealots >that broke away from Mandalorian society. Their goal was to re-establish the ancient way.
In terms of continuing to answer the question, it just confirms that some subset of Mandalotrians such as those that belong to "The Watch" believe that not showing one's face is "The Way", but like previous Mandalorian characters featured in other Star Wars content, not all of them do.
Din Djarin could come to change his views, as he learns new truths about both Mandalorian and Jedi/Sith history, but it's too early to make it a fact.
His strict adherence to The Way is a very fundamentalist interpretation that seems to have developed as a result of the Great Purge, which happened some time between SW Rebels and the end of the empire, when the Empire seized beskar armor and smelted it down for ingots, much like certain political parties wish the government to go door to door to seize firearms here in the real world, the natural reaction by those who believe that the armor and weapons are their natural right to possess, is to have their fears of tyranny confirmed, and drive those persons to believe ever more fervently that their religious belief in owning armor and weapons is fully justified by this demonstrated government tyranny. So, because of this imperial tyranny, confiscating armor, the Mandalorians have thus seen that their religious devotion is justified, and that those "New Mandalorians" we met in the Clone Wars show, who were pacifist, and did not wear armor or weapons, were wrong, and have been eradicated by the tyrannical empire. Those who survive rightfully conclude, much like modern-day 2nd amendment advocates, that had they kept their armor and weapons, they would have been able to fight back and prevent the empire's tyranny. So now, the surviving Mandalorians hold to a very strict interpretation of the Six Actions, the Resol'nare:
Speaking the Mandalorian language.
Defending yourself and your family.
Raising your children as Mandalorians.
Contributing to the clan's welfare.
When called upon by the Mand'alor, rallying to his cause.
So, the strict adherence to not removing one's helmet is the first of the six actions of Resol'nare, under a very strict interpretation. He contributes excess beskar to support the foundlings, serves (5) contributing to clan welfare. He broke the bounty hunters' code, because he identified the baby Yoda, a foundling orphan, with his own foundling status, as we see his parents were killed by separatists, the Mandalorians took him in and raised him as a Mandalorian, so he has served (3) defending yourself and your family. We now need to see him speaking Mandalorian, raising the kid as a Mandalorian, and rallying to the cause of the Mand'alor.
Mandalorians who did not follow the Resol'nare were considered to be dar'manda — someone who was ignorant of their Mandalorian heritage and bereft of their Mandalorian soul. The status of dar'manda was widely feared within Mandalorian society due to the belief it meant they were soulless and had no place in the Manda, the Mandalorian afterlife. Before and during the Mandalorian Wars, any, and all non-Mandalorians were considered dar'manda and soulless from birth, until they joined the Mandalorians and lived by the Resol'nare. Groups of captured individuals would often be forcibly inducted into Mandalorian culture and made to swear by the Resol'nare with or without their consent under the threat of death. Such zealotry faded over time as the Mandalorians became a less religious and more secular society.
It is thus clear that the Great Purge has caused Mandalorian society to return to its fundamental roots of stringent zealous observance of the Resol'nare. Perhaps out of a doctrine of atonement, a belief that the New Mandalorian society that arose before and during the Clone Wars was decadent and weakened the people, causing the Great Purge to occur.