He's not justified if you follow the flow of events.
He makes up an excuse to try and justify his behaviour, but it's clear he was basically trying to kill you for essentially irrational reasons.
Specifically the order of events is:
1) He waits for you out in plain sight in the middle of the road.
2) He lies to you about an intellect devourer that needs killing being in the bushes, and notes you've killed others, if you have (so clearly has been watching you)
3) When you go to kill it, or refuse, he ambushes you with a knife, and puts it to your throat.
4) He threatens to kill you if you don't tell him what he wants to know, and doesn't believe anything you say.
5) You break free one way or another.
6) He tries to excuse his behaviour by saying he thought you were with the Mind Flayers.
With 6, as he's been observing you, there are only two possibilities. He's lying. Or he's confused and irrational, because his behaviour makes no sense. He's a Rogue, if he really thought you were "with them", he could have vanished into the shadows (or just sprinted away), and if saw you killing intellect devourers, he already knows you're not "with them", if he's operating rationally.
So the best case for Astarion is that he's half out-of-his-mind and can be excused that way. He's certainly not justified in any normal sense.