he's supposed to (although, we all agree it often is dumb).
It will only attack teammates in two circumstances:
If a bonus is entirely controlled by teammates and it has >= 50% of the territories. It will only do attacks of 2 then.
If it's expanding into a new bonus that no teammates control.
(since it only ataccs with 2, simple make sure you've 2 armies on the borders to the AI, if you think/know(click the ai>see teammates ordes) it will atacc.