I make no apologies for writing science fiction. I love the genre with a deep and geeky love. Becoming professor of 19th-century literature at the University of London has done nothing to diminish my capacity for that mode of enthusiasm that fans call "squee".

Being a literature professor means, in effect, the government pays me to read books; and, taking my job seriously, I read a lot, in and out of genre. I think the novel is most alive today as a literature of the fantastic: at their worst, SF, fantasy and magic realist novels can be very bad; while at their best, they're by far the most exciting kinds of writing being published.

But here's the thing: my genre divides politically in a manner unlike others. Writers of historical or crime fiction might be rightwing or leftwing, but few would attempt to define those genres as intrinsically left- or right-leaning. SF is different: the genre defines itself according to two diametrically opposed ideological stances.

Let's take the lefty stance first, since it happens to be my own. Any SF text must include something that isn't in the "real" world: starship, robot, a new way of organising society, whatever. This might be material, social or even metaphysical, but it will encode difference. Alterity is fundamental to SF: it is a poetics of otherness and diversity. Now, it so happens that the encounter with "otherness"– racially, ethnically, in terms of gender, sexual orientation, disability and trans identity – has been the main driver of social debate for the last half‑century or more. The tidal shift towards global diversity is the big event of our times, and this is what makes SF the most relevant literature today. To say that SF has more imaginative and discursive wiggle-room than "realist" art is, while true, also to say that SF has the potential to be a more heterogeneous and inclusive conceptual space. This is something that's understood by the genre's greatest writers: Ursula K Le Guin, Octavia Butler, James Tiptree Jr, Margaret Atwood, Karen Joy Fowler, Pat Cadigan, Justina Robson.

On the other hand, many fans define SF as the literature of scientific extrapolation. There are those who think of "science" as ideologically neutral, simply the most authoritative picture of the universe available to humanity. The problem is that "authoritative" has a nasty habit of eliding with "authoritarian" when transferred into human social relations. Rightwing political affiliation comes in many forms, but for many rightwingers, respect for authority is a central aspect of their worldview. The world, says the rightwinger, is hard, unforgiving and punishes weakness: in order to prosper, we need to be self-reliant, subordinate decadent appetites to self-discipline, know what the rules are and follow them. There's lots of SF like this.

OK, I'll admit I've imported a caricature "rightwinger" into my argument. Nonetheless, SF contains many who believe the laws of physics make their ideology true. US SF grandmaster Robert Heinlein's credo, "There ain't no such thing as a free lunch", oft-repeated in his writing, folds a neutral fact of physics – entropy – into value-inflected judgments about things such as welfare and affirmative action. Orson Scott Card is a giant of the genre, but also a man who has declared that consensual gay sex should be illegal, and that any government that legalised gay marriage ought to be overthrown. Newt Gingrich, one‑time Republican presidential hopeful, has published SF novels; and books by writers such as Jerry Pournelle, John Ringo and Neal Asher sell extremely well.

It's a puzzle – not why these writers sell, for there are plenty of perfectly decent, book-loving rightwing people in the world (I take it as axiomatic that liking SF is an index of decency). I mean it's a puzzle for the genre. How can SF be both centrally about the articulation and exploration of marginalised and subaltern voices, and a projection of contemporary ideological concerns outward on to a cosmos in which the laws of physics themselves tell us to vote Conservative?

I'm not pretending objectivity. A full ideological reading of SF would interrogate the "hospitality to otherness" model with the same rigour as "the laws of physics validate my political beliefs" model. Heinlein's imagined interstellar future is an environment designed to valorise the skill sets (self-reliance, engineering competence, willpower, bravery and manliness) that Heinlein prized. Left-leaning Iain M Banks's Culture novels posit a high-tech geek utopia in which the particular skill sets, ethics and wit‑discourse of SF nerds turn out to be the gold standard of pan-galactic multi-species civilisation. I like the Culture a great deal, but I have to admit it's a "there is such a thing as a free lunch" sort of place.

Asking whether SF is "intrinsically" leftwing or rightwing is dumb, since literatures are not "intrinsically" anything. But I'm tempted to thump the tub nonetheless. Conservatism is defined by its respect for the past. The left has always been more interested in the future – specifically, in a better future. Myriad militaristic SF books and films suggest the most interesting thing to do with the alien is style it as an invading monster and empty thousands of rounds of ammunition into it. But the best SF understands that there are more interesting things to do with the alien than that. How we treat the other is the great ethical question of our age, and SF, at its best, is the best way to explore that question.

Adam Roberts's Jack Glass (Gollancz) has won the British Science Fiction Association best novel prize.