Clean code will help you get better rankings in Google. The opposite is true of badly written or massive code.
Also, page speed of your website is a important factor to rank well in the search engines. For example, Google’s PageSpeed Insights tool gives you instructions (reduce server response time, reduce size of your images, minify CSS, etc.) how you can improve your speed on all devices.
Website design is not only about making it look beautiful. If your website has lots of traffic, but if your visitors don’t buy anything or sign up, there’re of no value.