Firstly Akainu didnt took a second. It took him almost an hour something to return.
He was underground for a single chapter...during which the only thing that happened was BB and WB fighting for a few minutes. He returned after a few minutes because he was tunneling through the ground to get to Luffy.
Check the fight scene again
You must be registered for see medias
I assume you meant to link the fight between WB and Akainu. That shit was filler. None of that happened in the manga.
His goal was only to execute Ace. He didn't want luffy to escape MF.
Which he was going to accomplish by executing Luffy...
Lets also not forget that He went after Luffy when the MF arc was about to end. Before that he was fighting WB.
Before that, he only attacked WB when WB was getting to the plaza. His focus was on Luffy and Ace.
So its rather funny to say that he didn't want to finish WB because he finds a half dead guy more interesting than a Yonko who declared war just to rescue one of his men.
He was more focused on killing Luffy because Luffy was Dragon's son, the current worst criminal in the world. It's the same reason he wanted Ace dead: he has the blood of the former worst criminal in the world.
He wasn't focused on killing WB because:
1. WB was an old man who was just going off of the fumes of a bygone era. Akainu himself noted that WB doesn't really do shit but float by the power and reputation of his name without actually causing much trouble, which directly contrasts to the son of the worst criminal in the world who keeps causing one chaotic incident after the other.
2. Killing an Emperor isn't as simple as being able to, as the Balance of the Three Powers and the power vacuum that would result from killing an Emperor.
Throughout the world, Akainu explicitly notes several times his intentions to make sure Ace and Luffy die, yet never expresses that intention for WB and only fights him when WB gets close to the plaza and again when WB went out of his way to attack him