Is a 4-storied building constructed on a river bed safe?

Much like the others have stated: it can be.

There are at least two major areas of concern (assuming that environmental issues have already been resolved).

First, river bed implies river water. What amount of water and how often? Flowing water can easily sweep a normal building away so the measures to counter this can be significant.

Second, river beds tend to have a lot of loose sediment and clays. Both of these tend towards poor foundation soil. The usual solutions are either wide mat foundations that float the build on the soil or deep foundations that bypass poor soil until acceptable base is encountered. This can be more than 100 feet deep in case of river beds.

At the end of the day it isn’t a case of can it be safe, but what would it take to be safe.