Leaving is always an option.

Recognise that she is empowered by the organisation and you are not. Therefore, in your position, you will generally have to comply with what she wishes even if you feel it is wrong.

If you want to tough it out, I have a plan for you. Firstly, accept that your 'zone of influence' within the organisation is small. There are things that you can control and things that you can't control, and in your current situation there is not much you can control. Psychologically, what you can do is to choose not to be bothered by what you can't control. In other words, you can choose to abide by the maxim "Happiness is not getting what you want, but wanting what you get."

Also, you say you are in fear. Remind yourself that it is no big deal if she is upset, if you need to leave the company it is ok. You have nothing to lose. Try to see the humour of her overreactions. Of course, do not try to provoke her, but do it out of prudence rather than fear.

Remember, although you do not have much control within the organisation, you do have control over finding another job if you decide to do that.

Another thing I would do is arrange a short meeting with your report where you concisely outline the issue and how it is challenging you. This can be very difficult to do without causing more harm to the situation but it will help you if you raise the issue early. Keep the meeting short, you do not want to take up your boss's time with drama.

There are two key points you should make in the meeting. One is that the situation is challenging for you. You can literally say "I am challenged by this situation." Framing the situation in this way emphasises that you see it as a problem for yourself, not for the organisation, not for your boss and not for your PO. The second key point is to briefly outline what you will do to address the challenge. Generally this will mean focusing on your programming duties, being polite to your PO and being careful not to be a cause of conflict or distraction. Raising these two points will show your boss that you are being proactive about performing well in your job and addressing the interpersonal challenges of the workplace.

In this meeting you do not want your boss to go away thinking he should take action, such as disciplinary action or getting HR involved. Trust me, this would never go well for you. Therefore you should be careful not to create the impression in your boss that you would like him to take any action, you can also explicitly state that you don't want him to take action.

The purpose is to simply raise the issue and show that you are taking it on and dealing with it constructively. It opens a dialog with your boss about it. If your boss is a good boss you should be able to talk to him about challenges you are facing and not be afraid of him judging you unfairly, this is fundamental to a healthy relationship with your boss. Beyond this, having opened the dialog may help you in the future. For example, if at the end of the six months there are certain complaints raised that you can trace back to badmouthing by your PO, you can confidently and politely point that out. If you had never raised the issue of bulling prior to that time then you will have no credibility at all. Further, if the bulling reaches a level that you can no longer tolerate, you can go into a meeting stating that you've decided you need to leave the company. If your work has been good up until that point and your boss knows you've being trying to do the right thing, he may be able to move you to another project within the company. At the very least he will understand what's gone on and your resignation will not seem abrupt. Keep in mind it is quite possible he has no power to move you to another project to keep you away from the PO.

Good luck. Trust your instincts. If working for four more months and not getting extended seems like a waste of time you need to make that calculation for yourself and do what's best for your career.