I am working on a project to make a dimmer using the triac and a photocoupler, and I want to know if I can use a digital potentiometer to regulate the intensity of the light. I know it works for direct current, but will it work for AC?
Yes, but with limitation. As the datasheet says: +-5 V max. (page 4)
I would suggest using triac driver Optocoupler instead.