Every once in a while my screen dims, I don't want that to happen. Just now it did it while I was moving the mouse.
It's true that the Ambient Light Sensor causes this problem in many cases. But I want to present an alternative answer.
If your power adapter is plugged into a wall socket or a power strip and the connection is loose, the computer will switch between Battery mode and Power Adapter mode. Since many of us have different power settings for Battery vs. Power Adapter mode, this will cause the screen to randomly dim and undim.
The fix is simple.
I'd suggest you install a brilliant app called Caffeine. It's free and will do exactly what you're after. It sits nicely in your menu bar and with a simple click toggle you can enable activate/deactivate it. It also allows it to be activate for a set amount of time.
If you don't want to use a 3rd party app you can always disable Display sleep via Energy Saver preference pane.