You need to convert Phylum to a factor, ordered by the mean abundance. I think this will do it.
d3 <- d3 %>%
group_by(Phylum) %>%
mutate(
mean = mean(`Relative abundance`)
) %>%
ungroup() %>%
arrange(desc(mean)) %>%
mutate(
Phylum = factor(Phylum, levels = unique(Phylum))
)