If you are getting a 404 error when trying to access your website Sitemap with Rank Math, This is how you can fix it
According to this Rank Math article If you are getting a 404 error when trying to access your website’s sitemap index, you may have to flush your permalinks setting. To do this, go to your permalinks setting, within the ‘Settings’ tab in the left panel of WordPress (ie. https://yourwebsite.com/wp-admin/options-permalink.php”. Once in the permalinks setting, just go ahead and hit the ‘Save button and that should flush the permalink. After go over to the sitemap page (ie. https://yourwebsite.com/sitemap.xml)
This is How Your Sitemap will look after the 404 Error is resolved
Please let me know if you have any problems, questions, or if this method worked for you in the comments below. I hope this helped