I am providing you solutions which will help you in preventing installation of any app which you do not want to install automatically or from outside of the Windows Store.
Prevent Programs From Installing Through Windows Settings
You can easily disable the feature that will prevent you from installing the third-party app even if it is a desktop app. You can only install the Store apps by applying below steps. And if you try to install any app from outside the Store or desktop app, a pop-up message will appear which says that “you can only install apps from Windows Store”.
Prevent Programs From Installing Through Windows Settings Block new installations through Registry Editor
Block new installations through Registry Editor
Some users said that few apps from Store get automatically downloaded like Candy Crush or Candy Crush Saga, even if they do not need those apps. Here is an easy trick to stop installing any app from the Store to have maximum free disk space for other useful purposes. This should give you some protection against automatic software installation or even if you want to install software yourself but the software has not been verified from Microsoft, Windows 10 will not let you install it on your computer. This can be a great security measure on sensitive systems and a great saver from ransomware.