Yes, you can publish fiction or non-fiction, whichever you choose.
One isn't better than the other. They both have their advantages and disadvantages. While fiction is the bigger market on Amazon, it can be a bit more challenging to come up with a story and produce a book that is entertaining to the reader. There also isn't as much potential for back-end marketing. Whereas non-fiction books are typically easier to create and has more potential for back-end marketing.
It's a matter of personal preference, but it's worth experimenting with both and also depends on what your long-term goals and vision is. My Mastering Book Publishing course teaches how to publish books in fiction and non-fiction markets on Amazon.