Person A is your coworker of the same status in the company. Person B is your manager.

Person A behave friendly towards you in one-on-one situations but shows disrespects then person B is present, by for example not noticing you exist, not saying 'bye' when this person is busy etc.

Person B behaves normally. Person A behaves normally towards person B.

Now what I understand is person A tries to maintain good relationship with me and at the same time tries to lower my status(among the group) for personal benefits(?).

How to stop it and extricate myself from this situation?