You can follow along here to perform cleanup. Removing the host from domain if needed, then after cleanup and things are cleared up you can join host back to domain. Just make sure you know the password to local administrator account before hand.
https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/deploy/ad-ds-metadata-cleanup
https://techcommunity.microsoft.com/t5/itops-talk-blog/step-by-step-manually-removing-a-domain-controller-server/ba-p/280564
--please don't forget to upvote
and Accept as answer
if the reply is helpful--