You do not need to do so if you can ensure that you don’t swallow anything during the visit. If you’re unable to do so, it would break your fast however, during wajib fast one should avoid visiting the dentist, unless it is necessary, and cannot be postponed