I'm planning to make a C++ project using a 3D library to visualise space and planets, maybe using raytracing. I wanted to know which library is the most appropriate to achieve it.
You don't want to use raytracing. This is a very expense rendering system, and since you plan on rendering planets its really not very useful. Consider Space Engine: