Hello,
You can play with Windows Firewall in order to achieve what you want, below a thread regarding that to help you :
https://social.technet.microsoft.com/Forums/windowsserver/en-US/49935196-6c86-4eed-863a-9d291497fb56/firewall-to-block-external-remote-desktop-connections?forum=winserversecurity
Regards,