William Golding first of thought of the idea of Lord of the Files while reading Coral Island by Ballantyne. The story is, "about a trio of boys stranded on an otherwise uninhabited island, shows how, by pluck and resourcefulness, the young castaways survive with their morals strengthened and their wits sharpened."
He questioned what a "true" story would look like if a group of kids were left together on and island without supervision. Lord of the Flies is William Golding's response to that question. The story clearly falls under the fiction the genre but would also fall under the allegory genre. The group of kids represents a lawless society of humans in any setting.