You can do this using Local Group Policy Editor. Open the Local Group Policy Editor and go to the below setting:
User Configuration\Administrative Templates\All Settings\
Then, scroll down or search for “Prevent access to drives from My Computer”. Double click on it and select Enabled option. Then, under Options section, select “Restrict <drive name> drive only” option from the drop-down box and click on Apply and then OK.
Now, the select drive will be blocked.