Google’s John Mueller said that it doesn’t matter if your website is hosted on an IP address that also hosts other websites that are spammy. However, you should choose a fast and reliable web host:
I'm not aware of any ranking algorithm that would take IPs like that into account. Look at Blogger, there are great sites hosted there that do well (ignoring on-page limitations,etc), there are terrible sites hosted there. It's all the same infrastructure, the same IP addresses.
— ? John ? (@JohnMu) September 18, 2020
There are many reasons to pick good hosting over cheap hosting, and having a good/fast/stable site w/happy users does reflect in ranking, but ranking shouldn't be the primary reason. That said, I'm super-supportive of testing like this even if I don't agree with all results.
— ? John ? (@JohnMu) September 18, 2020
There are other ranking signals
There are many signals that have an impact on the rankings of your web pages on Google. Check your pages with the Top 10 Optimizer in SEOprofiler to improve the rankings of your website in Google’s search results: