Hey there!
A simile is a phrase comparing two things using like or as.
An example would be : I was cold as ice! This is a simile because it is comparing your 'coldness' to being an ice cube by using the comparison word 'as'.
A metaphor is a phrase used to compare two things that seem illogical.
An example would be : I think that Lilly wakes up too early, she's an early bird. This is a metaphor because Lilly is a human, and she can't be a bird, but the word early bird is used as a comparative phrase to show how early she wakes up.
Pertaining to the original question, we can have both simile and metaphor for something that tastes sweet.
Let's say something like a cake.
For simile, we would need to compare this cake using 'like' or 'as'. One example of this could be, 'The cake was sweet like candy!'
For metaphor, we would need to use the word cake to compare it to something illogical. An example of this would be, 'The cake was so tall, it taller than the Eiffel Tower.'