How stellar prevent DDoS attack from rest API (https://horizon.stellar.org/)
At Horizon, there is a "rate limit" variable, which ensures no more than N requests from same IP in one hour.
X-RateLimit-Limit --- The maximum number of requests that the current client can make in one hour. X-RateLimit-Reset --- Seconds until a new window starts. https://www.stellar.org/developers/horizon/reference/rate-limiting.html
Note that Horizon is just an entry point to the Stellar blockchain network.
On the wider perspective of the underlying Stellar blockchain, the small transaction fee could somehow deter extensive gabrage dump into the network.
The fee is small enough to be ignored by normal users, as each operation costs a fee of 0.00001 XLM (around 0.0001115 USD). For intended DDoS attackers, ENORMOUS multiple of 0.00001 XLM will be charged.
That said, if you have the money to burn, you could DDoS the public network.
The current values at the public Horizon are
x-ratelimit-limit: 101 x-ratelimit-reset: 1
which means "maximum of 101 requests" in "every 1 second".