We present a fully compressible, density-based finite volume solver for the simulation of 3D cavitating flows in viscoelastic Maxwell-/Oldroyd-like fluids. The upper-convected Maxwell model, the Oldroyd-B model and the linear and exponential simplified Phan-Thien Tanner models are implemented as viscoelastic constitutive equations in conservative formulation, and we identified the Truesdell rate as appropriate objective time derivative for compressible flows. Cavitation is modeled by a single-fluid homogeneous mixture equilibrium approach considering condensation and evaporation assuming volume averaged mixture quantities. The corresponding simplified quasilinear system is analyzed, and the wave speeds are calculated in order to adapt the employed four step Runge–Kutta explicit time stepping concerning the viscoelastic transport equations. We introduce a novel ghost cell boundary condition for the viscoelastic stress tensor. The approach is tested against (semi-)analytical unsteady and steady-state references and shows very good agreement. 3D simulations of the spherical vapor bubble collapse are performed for all implemented viscoelastic models and show a distinct influence compared to the Newtonian case. For the upper-convected Maxwell fluid a variation of the relaxation time exhibits its perspicuous influence on the dynamics of the collapse.