Replacing a dimmer switch with normal light switch (picture)
The simplest thing to do is to turn the breaker on and figure out which black wire is supplying the current. (This is arguably one of the more dangerous approaches, but it is safe if you follow precautions like have someone guarding the wires so they are not touched while the power is on.) Use a multimeter and test the voltage between the ground wire and every other wire. Exactly one black wire should have 120 volts on it.

If not, stop and report back here.

Once you identify which black wire is hot, turn the breaker off.

Then wire nut all of the whites together. Wire the "hot" black wire you identified to one other black wire. Turn the breaker on. Note if the ceiling light came on. If not, turn the breaker off, hook up the other black wire to the hot black wire and turn the breaker on. Note if the ceiling light came on. Turn off the breaker.

Now you know: 1. which black wire is the "hot" wire, and 2. which black wire goes to the ceiling fixture, and 3. your "other" black wire, which probably provides power to another switch or outlet.

You should wirenut the "hot" wire and the "other" wire together with a short scrap of black wire to create a pigtail. Connect the pigtail to the switch. Connect the black fixture wire to the other side of the switch. And your whites should already be wire nutted together from before. So just hook up the ground wire to the switch, and you're done!