Laws regarding the use of motorized vehicles, including modified ones, on sidewalks can vary depending on your specific location. However, in general, it is not legal to ride a motorized dirt bike, even if it is a modified "Razor" toy bike, on sidewalks. Sidewalks are typically reserved for pedestrian use and riding motorized vehicles on them can pose a safety risk to pedestrians.
To determine the specific regulations in your area, it is advisable to consult your local traffic laws or contact the appropriate local authorities, such as your local law enforcement or transportation department. They will be able to provide you with accurate information regarding where and how you can legally ride your dirt bike. It's important to prioritize safety and adhere to the laws and regulations to ensure the well-being of yourself and others.