This sounds to me like The Player of Games, by Iain Banks, published in 1988.
It is one of the best known of the author's Culture novels (which cover all sorts of different science fiction subgenres) and the second one he published. It has been published with a number of covers, but this seems to be the most common one.
The common setting of the Culture is described by Wikipedia as follows.
The Culture is a society formed by various humanoid races and artificial intelligences about 9,000 years before the events of novels in the series. Since the majority of its biological population can have virtually anything they want without the need to work, there is little need for laws or enforcement, and the culture is described by Banks as space socialism. It features a post-scarcity economy where technology is advanced to such a degree that all production is automated.1 Its members live mainly in spaceships and other off-planet constructs, because its founders wished to avoid the centralised political and corporate power-structures that planet-based economies foster.
The sex changes play a particular role in this novel, and they are mentioned in this detailed review:
Gurgeh's sexual and personal identity is remarkably un-fluid given the society he inhabits. (Sex changes and sexual preferences are very fluid.) He is one of the very few in his society who has not never changed sex, or (being a man) has slept with a man.