No one has dementia “on and off,” so what I think you’re talking about is that sometimes she’s less confused than other times, or at least about who you are. There’s really not much you can do here. I would keep my distance from her when you can. She may have met someone who looks like you in the past, and doesn’t trust that person. You can’t convince her otherwise, so just be polite, smile, and give her space when you can.