Absolutely! Installing Office 365 on a D drive is totally doable and will work just as it would if installed on the C drive. All you need to do is specify which directory you want Office 365 to be installed in when the installation prompts for it.
It's important to note that there are certain limitations when installing Office 365 on a non-system drive, such as potentially slower performance with some features and components, depending upon your hardware configuration. However, other than that this process should be straightforward.