Well, first off, you need a solid idea. Maybe it's a new form of technology or a strange alien world. Then, focus on creating well-rounded characters with their own goals and motivations. Also, pay attention to the world-building - make it detailed and believable. Finally, have a clear beginning, middle, and end to your story.
To write good science fiction, you could begin by imagining a future society or a scientific discovery that changes everything. Develop characters who face challenges because of this. Add some mystery or conflict to keep the story exciting. And don't forget to describe the science in a way that's easy to understand but still seems amazing.