It may sound like a cliche, but write what you know, or research until you truly know a subject inside and out. Live it, if possible.
When I wrote my first novel, Someone Else’s Tomorrow, I set most of the book inside a quirky little restaurant, El Pollo Loco. (Years later a restaurant opened with this exact name. )
One reason I did so was because I worked in a restaurant in college for about a year. I knew the backside of the restaurant business. (Yes, backside. It fits, believe me.) I don’t know how to run a restaurant, but I know employee habits and how things get set up and turned over. One of the comments I got from numerous people was how they recognized the little details that I included.
When I included things like breakfast prep work I had no idea that people would recognize the truth in the actions I was typing about. It just was part of the scene.
So this isn’t to say you can’t write sci-fi, or about a foreign country, but do research and keep the details true to things you do know. Most writing really is about relationships, not the background, so good fiction or good science fiction is about people and how they inter-react.
Keep writing and honing your craft and keep it real.