A team at Edinburgh University's school of clinical sciences and community health found that teenagers aged 13 and 14 living in disadvantaged circumstances in the east of Scotland tended to reject healthy school meals, because they didn't like queueing and would rather "hang out" with friends.
The researchers praised Glasgow's new incentive scheme offering rewards for healthy eating as well as the "wise choice" initiative, run by some retailers in conjunction with schools.
Wendy Wills, a researcher in child and adolescent health who led the research (she is now based at the University of Hertfordshire), reported that all 36 participants in the study said they felt constrained when deciding what and where to eat.
"Each school had more than one dining hall and more than one session for lunch, and students' entry to the dining halls was staggered by year group, whether they wanted to eat hot or cold food and, in one school, whether they were wearing the correct school uniform," Dr Wills reported.
"Many participants described these constraints as frustrating, because they could not eat lunch with friends from other year groups and could not always access the foods they preferred to eat."
While pupils had understood the recommendation about eating five portions of fruit and vegetables a day, and knew that exercising was a good way to lose weight, the wider message of why healthy eating was important was failing to get through.
Those who took up their free school meal entitlement - a third of the sample - did not buy food outside school because of lack of money. They therefore had little choice but to accept the lunchtime conditions of the dining hall, or go without - which a minority of teenagers reported doing.
Those who bought food at shops and fast food outlets also complained of having to queue. Some of the youngsters who took part in the study said they bought bottled water because canned fizzy drinks were more expensive.
Some described the price of food at school as representing poor value.
In general, food and eating were rarely given precedence over other activities. Most of the study group wanted to eat quickly in order to play football and other games, to attend lunchtime clubs and practice sessions, and to spend time with their friends.
Boys were more likely to be involved in physical activity at breaks and at lunchtime, playing football or running around with their friends instead of eating.
Girls in the study were more likely to spend non-curriculum time talking and hanging out, activities which could be undertaken while eating snacks and meals. Girls also reported spending longer over their lunch and were more likely than boys to leave the school to walk to local shops.
Dr Wills said: "Our findings suggest that, unless the problems associated with queueing for school meals are addressed and better understood, it is likely that young people will not consider the healthier options, even if they become available."
Dr Wills added: "It was clear that young people's desire to maximise free time between classes meant that food and eating were not assigned a high priority. This is an important consideration when deciding how food in schools is delivered."