For the past year I have been working on the libretto for my next project, a community opera in Bridlington by composer Harvey Brough, commissioned by Opera North. The opera, which was due to premiere on 15 July, takes place over a day on the beach. All human life is there: kids on a school trip, grannies with sandwiches, dog lovers, holiday makers, even a landscape painter. It is Benjamin Britten's Albert Herring meets Death in Venice, drawn by Donald McGill.

The narrative revolves around a single father who, having been made redundant, is forced to take a holiday at home instead of in Ibiza. However, he is completely unable to have a quiet day beside the sea as he is assailed by schoolchildren on a biology field trip, local yobs – and the entire Bridlington Amateur Dramatics Society, who are rehearsing the Bridlington Pageant. There is high drama: at one point, his son is swept out to sea. Essentially, though, it's a comedy about tolerance and inclusiveness.

Rehearsals have been under way for six months. Nearly 400 people of all ages are involved. I am a huge believer in drama's capacity to change lives, and this has been a rich, rewarding and exciting project for all involved.

However, two weeks ago I received the worrying news that the main primary school involved was threatening to pull nearly 300 children from the production. They had problems with the libretto, and requested a list of changes. "Pee-pee" and the use of "stupid" as an insult were objected to. The composer and I worked with the school and Opera North to reach a version that would work for everyone.

But by last week, we had reached an impasse. The opera's main character is a gay, retired painter, and in one scene he is the victim of taunting. At the school's request, I agreed to tone down the violence of the language in this scene, but not the character's straightforward defence of his sexuality. Word came back from Opera North that, unless I removed the lines "I'm queer" and "I prefer a lad to a lass", the whole project was in jeopardy. (It was by now far too late to replace 300 schoolchildren.)

The request seemed to come from an entirely different era. I thought there must be some mistake, and that Opera North would support me by finding a way around this completely outdated hysteria. I was amazed when they accepted the school's position. I was repeatedly asked to excise these references to the adult character being gay.

I have spent years working in theatres and schools, and had never come across such an extraordinary situation. It seemed the school believed this particular scene threw up issues that were age-inappropriate – even though no children were involved in this part of the libretto: it was purely an exchange between adult performers. I urged Opera North to open a dialogue with the children's parents, being entirely open about all the issues. Having written Billy Elliot, which currently has productions all over the world featuring a gay, cross-dressing prepubescent, as well as scores of kids swearing and doing things they "shouldn't" on stage, I was convinced that any disquiet in the parent body could be easily remedied. Parents, particularly working-class ones, are very open and sensitive. And, to be quite honest, sexuality has never really been an issue that has caused much consternation. Opera North did not want to pursue a dialogue: either I cut these gay references or the project would collapse.

I then offered to pay for Stonewall's education department, who work with 180 local authorities, to give workshops to the kids and parents, so any issues raised in the opera could be given a proper context. This was rejected by the local authority. On Saturday, I was told by email that the school has withdrawn and that Opera North are no longer able to maintain the project.

Ironically, the opera was due to be performed the same weekend as this year's gala of the enormously successful Billy Elliot Youth Theatre Project. Last year, I persuaded Working Title films (who adapted Billy Elliot) to fund a nationwide project whereby youth theatres from all over the country put on productions of the musical. A gala was held in the Victoria Palace theatre in London, where the best of the regional performers came to share their work. It was overwhelming, with hundreds of kids singing passionately about politics, sexuality and the finer points of industrial conflict; Working Title immediately committed to doing it again.

A scandal in the making

That a commercial theatre producer is willing to support such work, when publicly funded bodies are trying to censor a community venture on the theme of tolerance, is deeply confusing to someone brought up in the heady atmosphere of 1970s theatre-in-education. For me, the whole point of this kind of theatre is to challenge expectations and to invite discussion about issues that are more often swept under the carpet. Theatre can be a brilliant, democratic tool for exploring issues in a way that everyone can understand. Most importantly, the very act of theatre, especially in a community play, is one where we are all included, whatever our abilities or differences; this is why I continue to be committed to this kind of work.

What I find bizarre is the insistence that no one – not the school, not Opera North, not the local education authority – is being homophobic. Instead, we have the strange position that, because the children are of primary-school age, these lines are too difficult and confusing for them. It feels to me that, because I was unwilling to remove these lines, the opera's chance of taking place has vanished. The whole project has cost well over £100,000, and has involved hundreds of people and thousands of hours of writing, composing and rehearsing. That a play about tolerance, community and civic values could founder over this seems unbelievable.

Strangely, Opera North's original brief to me was to think about the work of Britten, a lover of the British coast. Even the most cursory look at Britten's Peter Grimes, Death in Venice and A Midsummer Night's Dream show us that gay characters are no stranger to British opera. But British culture has moved a long way from the repressive homophobia which we all took for granted. Kids, especially, now grow up in a culture where gay people are celebrated in a way that was unthinkable just a few decades ago.

I am fighting to keep the opera on. It will be a scandal if it is not performed – not just because of the public money wasted, but because ignorance and timidity will have won the day. No one involved will countenance the idea that there could be homophobia at play. The argument is that everyone is just worried about other people's sensitivities. It amounts to the same thing. Effectively, I feel I am not being allowed to represent a gay person. The idea that being gay is something inappropriate for a child to witness is unsupportable – as if gay people weren't fathers or mothers or sisters or brothers. That an opera company or a school could make this mistake seems extraordinary. I feel I have no option other than to try to open up the debate.