This can work, if your players are experienced roleplayers that don't take story developments personally.
I've run various games where the PCs are not "all on the same side." (In fact, there are various RPGs - Amber, Fiasco, Paranoia - who are predicated precisely on that assumption.) Many novels and movies have that exact kind of plot, where the protagonists are working against another in more or less secret, all the way to "we're together till we beat Lord Whoever, then all bets are off, frenemy mine!"
As a result it's certainly tempting to bring the same drama to your RPG. The major obstacles are a) people whose play assumption is that the PCs are all totally on the same goals and b) people who don't have a strong emotional separation between the real group and the in-game group and would feel hurt about such a twist.
You can't go from zero to 60, but here's ways you can prime the pump to make such things palatable to your group.
Give PvP Opportunities
In my games, I'll often let a player run an enemy NPC or whatnot if they're not in that fight (dies, incapacitated, showed up real late to the session and their PC is back home, etc.). As a GM it's hard to put enough zazz into a complicated enemy stat block, especially with all kinds of other stuff going on. And, it gets the group used to having players opposing players without making people cry. (Playing board games and the like also helps). Try playing some of those games I list in the intro that don't assume party hivemind. They are different - Fiasco, for example, assumes everyone knows what's going on, just that everyone is about putting together a good story instead of "winning da fights." Amber and Paranoia are more about secretive screwing over the other guy. Introduce the idea so it's not like "I didn't know you could do that in an RPG!"
Incorporate Realism Early
You don't have to have BETRAYAL!!! to have PCs with differing agendas that don't always want the same solution. Pathfinder Society play has PCs in different factions where they in general want to "solve the adventure" but have different goals, different people they want to get the credit/wealth/info from it, etc. No PvP is allowed, but that helps get people to start thinking and break hivemind syndrome. Also, simply doing more note-passing and information compartmentalization drives this behavior quickly. In the real world most groups are composed of individuals with their own goals and different amounts and type of buyin to the group conceit - at work, on a sports team, etc.
Set Clear Ground Rules
So as to not surprise people, make sure and clarify that such things can happen as part of a campaign briefing.
Here's some examples of campaigns I've been in or run where player betrayal was part of the storyline.
In one game, I had a player who was disruptive, even when he was allegedly not against the rest of the party. After he suicided one character in a fit of pique, he called me up and said "You know what was wrong with my last character? He was too much of a team player. I want to play an assassin or something." I sighed. So I came up with the plan of him being a Scarlet Brotherhood spy sent to report on the activities of the PCs - but to never break his cover! This worked great - he was a team player by day and scribbled off letters to his handlers at night. The rest of the group figured I had threatened him with a good solid beating or something to turn him around like that. The player left the campaign some time later when he moved, before I had the chance for a betrayal scene. But if he had, the group would have probably taken him out (his plans were not known for their logical rigor) and he would have rerolled a new PC, gleeful at his accomplishments.
I was playing in a Planescape campaign where we were supposed to go get artifact bits and then lock down some kind of blade-lord proto-gods that were trying to escape and kill all the gods. But I was a bladeling, and they started sending dreams to me. I struggled with this all through the campaign and at the very end we were down at the planar prison with all the doohickeys (of course the place to destroy it is also the place to use it, because story) and I told the rest of the group "The gods never did anything for me, screw them, I'm gonna let these guys out." We faced off and had a tense negotiation. It was all of them against me, but I had the doohickeys and was like a super ninja so I reckon I might have been able to just rush the artifact to the planar curtain to free the blade lords. In the end we didn't want to fight each other and struck a bargain. We wouldn't release them but also wouldn't destroy the artifact. We gave a piece to each of us to go hide and let another generation of adventurers deal with it. Was this "betrayal?" Life's more complicated than that.
I had a very long 2e campaign run in full realism mode where the PCs were increasingly good/evil segmented (they all thought they were good, but half were of the "I'm good! But you know sometimes you need to ritually sacrifice a party member for the greater good!" kind of evil). At the end, I goaded them into trying to kill/feeling obligated to protect the same person as part of the campaign climax. It took a lot of work to get there, but everyone really enjoyed the story and they didn't bellyache or fight each other in person afterwards. But they were grown-ups who understood the kind of realistic game they were playing, and valued that and the awesome story that resulted.
I was running a Forgotten Realms campaign and, on the way to the "real" adventure (Four from Cormyr, I think) the PCs stayed at this inn run by some ladies who were actually vampires (It was actually in some FR sourcebook or another as just a road encounter). Well, so one thing leads to another and one of the PCs gets vamped and a necromancer in the inn puts a spell on her so she can walk around in the daylight for a bit. The PCs get out to the remote encounter location, which features a shrine undead can't enter (obvious "camp site"). Well, after a big fight with the local baddies where half the party's downed, the vampire PC betrays the party and drags off another PC and vamps them. This led to several months where the campaign was half vampire PCs hiding out in the swamps during the day and the living PCs hiding out in the shrine. Vamps vamp PCs, PCs kill vamps and rez them. Everyone had a great time. Eventually they escaped back to the inn and burned it down. It ended the campaign "early," but that's one of those things where the group ends up doing something other than Your Perfect Prepped Story so that's fine.
I haven't really had this go too bad in my entire gaming life. Every once in a while someone has had their PC betray the party just because they were kinda personally a punk, but usually after they are murdered by the party they just reroll - not since I was a Boy Scout and like 11 years old did I ever see the "and now the new character attacks the last character's enemies!"
Establish this kind of game with mature gamers, and you're golden. Short of that, YMMV. Other factors like "is it in collusion with a GM" or "do the players know what's up out of game or not" are not, in my experience, directly relevant (they are all valid sub-approach options).