Removing Entra Connect should result in these accounts being converted to cloud-only. Once this happens, follow https://learn.microsoft.com/en-us/answers/questions/5620111/duplicate-accounts-appearing-after-syncing-on-prem and then redeploy Entra Connect again
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin