The study, published in the journal Psychonomic Bulletin and Review, underscored people's implicit bias for fatty, sugary foods.
Researchers at Johns Hopkins University in the US created a complicated computer task, in which food was irrelevant, and asked a group of participants to find the answers as quickly as possible.
As the participants worked diligently, pictures flashed in the periphery of the screen - visible only for 125 milliseconds, which is too quick for people to fully realise what they just saw.
Researchers noted that all of the pictures distracted people from the task, but found that items like doughnuts, potato chips, cheese and candy were about twice as distracting.
More From This Section
The healthy food pictures - like carrots, apples and salads - were no more distracting to people than non-foods like bicycles, lava lamps and footballs, researchers said.
The team then recreated the experiment, but had a new group of participants eat two fun-sized candy bars before starting the computer work.
Researchers found that after eating the chocolate, people were not distracted by the high-fat, high-calorie food images any more than by healthy foods or other pictures.
"So we showed them carrots and apples, and it slowed them down. We showed them bicycles and thumb tacks, and it slowed them down. But when we showed them chocolate cake and hot dogs, these things slowed them down about twice as much," Egeth said.
The results strikingly demonstrate that even when food is entirely irrelevant, and even when people think they are working hard and concentrating, food has the power to sneak in and grab our attention - at least until we eat a little of it, researchers said.