Pupils at Fulford School have been warned to keep a look-out in case there is a repeat of the incident, in which a student found the needle lying on top of a sandwich bought in the school canteen.
Head teacher Steve Smith said no one was hurt by the needle, which was of the type used with textiles rather than from a syringe.
He said the school, which has 1,273 pupils on roll, including youngsters from villages across the area to the south and east, was investigating to find out how the needle came to be in the sandwich.
But he said it did not appear to have been put in when the sandwich was being made.
Mr Smith said: "Because of the way the needle was found on top of the sandwich, rather than embedded in the filling, it was apparent that it wasn't put in during the food manufacturing process.
"We have had incidents like this in the past where a pupil has put something in another pupils' food and we have got to the bottom of it quite quickly.
"We will now be investigating in this case to see how something like that could happen."
The Press has reported previously how one pupil at a York primary school pupil had been unable to eat her lunch after a bully spat in her sandwiches.
The paper also told earlier this month how education chiefs in North Yorkshire were looking at new ways to beat bullying in schools, with the council undertaking a full survey of pupils' perceptions in secondary schools.
One of the main focuses will be pupils' perceptions of what the council calls "vulnerable times," such as lunch and break times.
Comments: Our rules
We want our comments to be a lively and valuable part of our community - a place where readers can debate and engage with the most important local issues. The ability to comment on our stories is a privilege, not a right, however, and that privilege may be withdrawn if it is abused or misused.
Please report any comments that break our rules.
Read the rules hereComments are closed on this article