A sex story can be morally bad when it promotes objectification. Say, if it portrays a person as just a sexual object without any regard for their personality, dreams, or rights. It reduces them to just a body for pleasure. Also, stories that involve incestuous relationships are considered morally wrong in most cultures, and if a sex story includes that, it's a 'bad' one in a moral context.
When a sex story is used to degrade or shame a particular gender or group, it is bad morally. For example, if a story always shows women as submissive and only there for men's sexual needs, it is not only a bad sex story but also promotes harmful gender stereotypes. Another aspect is when it involves underage characters in sexual situations, which is not only immoral but also illegal in the real world.
If it involves non - consensual acts, that definitely makes it bad in a moral sense. For example, a story where one character forces themselves on another is completely unacceptable.