Solenoid valve with optocoupler and transistor

Ahhh, yes.
Thought you were using direct drive from an Arduino pin, but you're using an opto coupler and a 12volt supply.
Yes, that will work for this mosfet, since the gate now gets 12volt drive.
Leo..