You can use this method:
https://learn.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-import-export-config
or an older way of doing it:
https://identitydude.com/2018/06/08/duplicating-your-production-aad-connect-sync-rules-on-your-staging-server-using-the-aad-connect-helper-module/
The better option is to build a new server and make the that primary and then remove AADConnect from the current one