He preemptively apologizes to Shanks for trying to kill Luffy, and back at Baratie it seemed like he didn’t want to seperate Luffy and Zoro. Not only that, but it seemed like Mihawk would rather test his blade against strong opponents rather than pick on someone he knows can’t beat him.
If he really didn’t want to fight Luffy, he could have sought out one of the Division Commanders. My guess is that he either wanted to figure out why Zoro is so loyal to Luffy, or he wanted to know why Shanks gave Luffy his favorite straw hat and his arm, or both.
My other guess is that he wanted to measure Luffy’s “power”, which he technically ended up measuring when he realized Luffy’s true ability: turning everyone around him into his allies.
He probably became interested in measuring Luffy because of how Luffy defeated Crocodile, Lucci, and Moria. Mihawk probably wasn’t surprised Luffy could beat them in a one on one fight, but Crocodile had Baroque Works, Lucci had the navy, and Moria had his trickery and army of zombies. Because of that, Mihawk probably knew Luffy’s sheer strength wouldn’t have been enough, and he wanted to find out what’s special about Luffy that allowed him to overcome those odds. Like I said, he did find out when Vista got in his way.
Another, more mundane idea is that Mihawk fought Luffy just because Luffy happened to come into his path, and Mihawk may have seen it as pathetic or dishonorable to just ignore Luffy. His duty at Marineford was to defend against oncoming enemies, and Luffy was one of them.
What do you guys think?