And violations of HIPAA are a serious thing. Obviously this was not detrimental to you and your profession, but had it been worse, you would have had very high legal grounds to pursue action against (presumably) the Captain for privacy violations.
Secrets are not easily kept aboard a ship, but those in senior roles should know the responsibilities of their position. I saw first hand an OIM joking about the number of people on board diagnosed with PTSD and on medication (naming names). That OIM was released from employment two days later. I hear he tried to sue for wrongful termination, but no lawyer would touch his case.
To the OP, the USCG may require a diagnosis from a psychiatric professional. It’s up to the Medical Review Board from that point. Perhaps a nicely worded letter from your psychiatrist to the effect of them feeling confident you can hold the position without issues might not be a bad idea? I’ve worked with many people with ADD and ADHD, some on medication (others should have been), and while not the same, they are legitimate medical concerns.