I read this some time in the 1980s in the UK in a school library for 11-and-unders. (But that might not mean much. They had Assassins of Gor as well!) I remember it as being rather strange, and darker than this kind of book really ought to be...
There's a valley completely surrounded by inaccessible mountains. A village of peculiar, peaceful little people lives there --- possibly actual little people; my memory says they're not quite human. They're kinda conservative and nervous of anything that's different. There's a small group of misfits, rule-breakers and boat-rockers, and after some kind of inciting incident the village votes to exile them to live somewhere else in the valley.
Our heroine is exiled with them. She's extremely indignant about this, because she's as conservative as anyone else, but she's swept up in the witch-hunt too because she painted her door red, which the others don't like.
The misfits set up somewhere else in the valley, but various strange things start happening (I forget the details here) and quite suddenly our heroine finds herself kidnapped by armed soldiers and taken through tunnels to the other side of the mountains. There she sees that it's a vast inhospitable desert with an huge army camped on it. They're trying to invade the green land between the mountains.
Unfortunately I don't remember much else about it. I vaguely recall that the band of misfits manage to do something about the invaders, but I don't know whether they actually repel them or negotiate some kind of treaty.
Does this ring any bells with anyone?