Carr Hill School headteacher Patrick Earnshaw, 44, told pupils of the news at a special school assembly.
He will take up a new position as headteacher at a secondary school in Dorset.
He said: “I will take with me many wonderful memories of the staff, students and parents of Carr Hill from the last five-and-a-half years.
“I’ve had the pleasure to get to know very many of the parents in that time.
“I’ve always been grateful for the fantastic support you’ve given to my colleagues and I, as we have worked with you and our students to make this one of the best comprehensive schools in the country –and make no mistake, Carr Hill is a truly excellent school.”
Mr Earnshaw joined the Kirkham-based school in 2009 from Kirkbie Kendal in the South Lakes. It was his first post as headteacher.
He added: “I would have loved to have gone to a school like this when I was a teenager. I continue to be in awe of my colleagues’ talents and hard work – they have made the job of leading Carr Hill’s journey to excellence easy.
“More than anything though, I admire the wonderful young people who study here.
“Their desire to join in, to rise to every challenge, to support and care for each other, to reach out to communities around the world, but above all their desire to learn and their curiosity about the wider world, are remarkable.”