Yes, it's illegal to drive ANY motor vehicle in on the sidewalk. You'll get stopped, given a citation (or arrested), and the police can even confiscate the bike.
Also you can't drive a dirt bike on the public road unless it's "street legal": that means lights, plate number, sound suppressor and...