I think you're talking about Norn9: Norn + Nonet. It's my usual go-to when I think of "weird ships anime" but in this, a lot of details line up:
girl who was put on a ship...people living there who all have their unique magic skills
That's the basic premise of the anime; the anime starts with Koharu, having been picked up by the ship Norn, learns to live with a group of other magical humans. Specifically, she's one of a group of 11 people with special powers known as the Gifted.
On the ship there are gardens and a river
There's a lake, there's a garden that plays well into a later point, and there's a river! None of this is surprising considering how huge the ship is. They do have to grab their own food, and I don't quite specifically remember them having to dive, but they do have a water feature, presumably with fish, as seen below:
(Sidenote: the ship is the best part of the show and yet I have issues finding a good-res photo of it on DDG, life is unfair. Can't screencap it right now either.)
remember the girl protagonist can use fire magic
That is Koharu's whole deal, traumatic past and self-isolation included.
there is another guy who can use earth magic
If by "earth magic" you mean "can manipulate greenery and plant life" then that's Kakeru.
remember one scene the girl burnt the guy’s plants with her fire magic
From the Wikipedia article, the episode 2 synopsis includes:
After disappearing, [intruders] attempt to shoot and destroy the ship's center, aiming directly at the peach orchard where Koharu is. Using her ability, she deflects the ray and burns down the entire orchard in the process with her fire manipulation skills.
Again, I can't get visuals right now, but this scene towards the end of the episode sticks out in my mind, too.
I remember for a period of time in the anime the guy lost his powers.
From the above Wikipedia article synopsis of episode 9:
After they leave Senri's room, Akito takes all of his brother's powers and requests that Nanami erase Senri's memories of him, because Senri should live in freedom without worry.
More than "for a time" but in the anime, Senri isn't seen again until the finale, so I can forgive that detail.
In the comments, you add:
It’s definitely not in the space and not in waters but it’s a floating ship I think
Norn fulfills both those criteria--to use the Wikipedia article as a source once more, it states that Norn is "flying above towns". Not in space, not in waters, definitely afloat.