Is this a "will it work?" question or a "is it safe?" question, or a "is it to code?" question?
I'll answer the first one and the last one...
1) yes, if the bulb you have is dimmer compatible and it worked before you opened up this switch box...then yes, it should still work after you put in the dimmer
2) is it safe?... I choose not to answer this question on the grounds that nobody knows what sort of heinous things previous owners might have done.
3) is it to code? obviously not.
Probably what you're looking at is a situation where...
1) the black wire going up to the light broke somewhere back in the dark backward and abysm of time
2) the path from that light to the switch was somehow convoluted in a way that made it difficult to replace the wire
3) at that time somebody decided it was easier to change the way the light was wired rather than put in a new wire from light to switch. So they ran a new wire to the light and used its "neutral" at the light. The white wire was re-purposed to provide the "hot" via the switch. (conveniently, electrons are colorblind.)
4) either at the same time or some other time, somebody ran a newer power wire to the switch. Since the light was getting its neutral from elsewhere, and since the black wire to the light was broken, they used just the new black wire as hot lead to switch and white wire from there to light.
My primary concern here would be "why is the black wire to the light broken"? Since the white and black wires travel together, what breaks one of them often does some damage to the other one. Did somebody drive a nail or screw through the cable and sever the black and only damage the white? Did some settling of the building damage the whole cable and only the black was completely severed? Was it just a poorly manufactured cable? When the black went, did it arc and make some heat which probably damaged the white as well?
Long story short, this is obviously not an ideal situation. A couple of possible solutions present:
1) Admit to your landlord that you poked around at the wiring and discovered some things that have you worried for your safety...ask him nicely to pay an electrician to fix it properly.
2) Look into an alternative means of switching the light on and off and permanently remove this wall switch (and its wiring) from the equation. There are old-timey solutions like a pull chain switch on the light, or newer solutions surrounding the ever evolving spectrum of "home automation" that would give you other ways to turn the light on and off. (note, these both assume that the "new" cable presently providing neutral connection at the light can be set up to provide always on hot and neutral directly to the light -- might not be true, they could have "stolen" neutral connection from some other ceiling light.)