Wait until you arrive. There are regular ferries throughout the day and since you don't know exactly what time you will actually arrive and get to the port it would be a waste of money to guess.
You can see the current schedule here: https://www.capri.net/en/ferry-schedule
Ignore the note about buying tickets in advance "at peak times of year". This particular web site offers up to date and comprehensive information about Capri but their service fees for purchasing tickets borders on usury. Their "suggestion" about buying tickets is completely self-serving.Edited: 04 August 2018, 19:53