Sure, but in most of the US, riding on the sidewalk is illegal.
The law is subjective and when you’re rolling around in spandex on a multi thousand dollar road bike and a paramilitary USA “peace officer” stops you, the law doesn’t really matter. You just “yes sir” and hope to be allowed to move on