This question already has an answer here:

Is it true that any metric space consisting of $n$ points can be isometrically imbedded into $n-1$ dimensional Euclidean space? Hyperbolic space? (For $n=3$ this is true.) If not, what are necessary/sufficient conditions? The case $n=4$ is the first unknown to me case.

What happens with imbeddings into the unit sphere, where certainly one needs some extra conditions on the metric space, like perimeter of each triangle is at most $2\pi$.