What’s more important: Good writing? Or a good story?
(Of course, a book should have BOTH, but…)
Part of me wants to say that a great story told badly remains a great story regardless. A Tale of Two Cities comes to mind as a well-known example. Dickens got paid by the word, so he was long-winded and overly descriptive not only for style but also for financial security. (I would probably behave similarly if I got paid that way. Alas, I am salaried, so I just have to be awesome because I want to.) Two Cities is a great novel, though, despite being so very long. The story shines through the mildly infuriating technique.
On the other hand, a really great writer can make magic from muck. If you have a gift, you can create the literary equivalent of Luther’s snow-covered dunghill (which he may not have actually said). It remains garbage underneath, though. Even odorless trash is still trash, so story matters more than style.