Apple - Force Mac to display in grayscale
Yes, this can be achieved with AppleScript and Automator.
The setting to automate is located in:
System Preferences > Accessibility > Display > Use Greyscale
The keyboard combination option + command + F5 also shows Accessibility options.
This Apple discussion, Keyboard shortcut for "Use grayscale", shows how to use AppleScript and Automator to create a menu bar item that toggles the Greyscale on/off.