PWM dimming of a Meanwell HLG led driver

Most opto couplers will probably work. Try the common PC817.

Use a low frequency if you want a large dimming range.
I leave it on the default 200Hz of the PCA9685 for my LED lighting.

DIM must provide some voltage, otherwise dimming with a pot (see datasheet) would not work.
Leo..