This married man may be sending you mixed signals because he is wrestling with whether he should allow himself to pursue you or not.
On the days that he flirts with you, he may be giving in to just how much he is attracted to you and isn’t letting anything get in his way mentally.
However, on the days that he ignores you and gets angry with you, this may be his conscience making him feel that as a married man he shouldn’t be trying to flirt with you.
Hence, he takes out his mental frustration on you.
As far as what you should do, it may be best to only maintain a professional relationship with this married man and avoid flirting with him.
This way, you don’t put yourself in the difficult position of falling for him.
Falling for him could open up a whole new chapter in your life that causes a lot of mental stress and anxiety.