These are tricky situations. If you completely surprise your DM, thare’s a possibility you may short-circuit the plot arc, or torpedo the whole campaign. On the other had, if you tip your DM off, your opportunity to spring an effective ambush might be lost. A little ambiguity might be best.
It depends on whether the DM needs to know
There are valid reasons to keep a thing or two from the DM. It’s very hard to ignore information once it’s in your head. If you tell the DM that you are planning on betraying an NPC, that will certainly affect how they run the game, subtly, or not so subtly.
Be congizant of your DM’s storytelling
While some DM’s would be totally OK with a big player-initiated plot twists, for others it won’t be a lot of fun tearing up their planned encounters, maps, and lovingly-invented NPC’s. In your case, it sounds like this NPC is a pretty central character to the campaign, so use some care.
If your DM has a high-preparation style, it may be better to let him know you want to go down the “Let’s prepare to betray this guy” plot line.
You know your DM better than we do, so let that inform your actions.
If you’re unsure how much your betrayal might disrupt (or improve) the game, you can casually ask how it would go if “somebody” betrayed the NPC instead of going along with his plans. It’s hard to tell, though, how much a DM will pick up on your intentions. Just like PC’s confronted with a mystery, they might catch on the subtlest hint, or remain oblivious to the most obvious tip-offs.
A Shocking Reveal is Great Fun
I once had a PC who got captured, and agreed with his captor to try to take the rest of the party prisoner too. Everybody at the table was fooled. Even when I said, “I draw my sword and step behind [my captor],” nobody suspected I was doing anything other than seeking his protection.
If you want folks to gasp and drop their jaws when you spring your ambush, then keep your plans to yourself.
Since the DM is revealing a big plot here, it would be best to do this at the thrilling climax, instead of trying to blow up the story half-way through.
A Need-to-Know Basis
On the other hand, your treachery may be of the sort that requires preparation that you can’t hide from your DM. If you need a certain item, etc., to turn the tide on your adversary, then of course you’ll need to talk to your DM about your plans to acquire it.
But you can be cagey about your reasons. You might profess that you are looking to take possession of the dangerous artifact to keep it out of the hands of troublesome do-gooders.
Final Answer: Tell the DM what they need to know