Freedman proved that any integral homology 3-sphere topologically bounds a contractible, compact 4-manifold. If we start with an integral homology 3-sphere $\Sigma$ and double the associated contractible 4-manifold along $\Sigma$, then the resulting space is a homotopy 4-sphere, which is homeomorphic to $S^4$ (due to the topological 4D Poincare conjecture). So I think the core of the posted question is whether $\Sigma$ smoothly embeds in $S^4$. (It's easy to see that every homology sphere admits a locally flat topological embedding in $S^4$) There are Brieskorn homology spheres which smoothly embeds but some Brieskorn homology spheres do not embed. If I remember correctly, it's still unclear which Brieskorn homology sphere embeds and which does not. On P31 in Budney-Burton, they listed several Brieskorn homology spheres which do not embed in $S^4$ since the Rochlin invariant or d-invariant (which is mentioned in Marco Golla's answer) is not zero. However, Budney-Burton also provided Brieskorn homology spheres do embed in $S^4$ smoothly. See Theorem 2.13 or P24. I don't know if there are other classified Brieskon homology spheres which are not listed in their survey.
If one is willing to expand the roster of candidates, Marco Golla has already given a nice answer in general. A weaker question than the posted one could be whetherwhen an integral homology sphere can arise as the boundary of an acyclic 4–manifold. There are some recent research surrounding this, e.g. Homology spheres bounding acyclic smooth manifolds and symplectic fillings