Look at Program Files if you have a folder called Windows App and inside find if you have the Microsoft Flight Simulator Folder and another Microsoft Digital Ownership folder, if so, delete them both.
Then look in the Program Data folder and then in the Packages folder and if you have the same folders inside, then you delete them too and then restart the PC and try to install the game again.
This is if you have it installed on disk C or another.
Also check if the Packages directory is on another disk and WindowsApp if it exists on that disk and delete all the Nicrosoft Flight Simulator and Microsoft Digital Ownership folders