This article is from the Final-Fantasy and other Square Soft Games FAQ, by firstname.lastname@example.org (Nick Zitzmann) with numerous contributions by others.
If you examine the paper in the southwest corner of the first floor,
you'll find clues hinting at what the numbers are. Here is how to find
* When reading the paper, move the cursor down to the blank space
and try and choose it.
* Examine the area around the bed on the upper floor. Then go out
and look in the hallway nearby.
* Search the opposite end of the broken piano.
* Open the chest in the greenhouse, then examine the chest again
for another clue.
If you're not to be bothered with searching for clues, the combination
for the safe is:
* Right to 36, Left to 10, Right to 59, Right to 97.
Remember, operating the lock is like operating a real-life combination
lock. Turn in the specified directions, and don't go past the number you
want, or the safe won't open. Since there's a time limit, I suggest
hurrying toward the number you want, then slowing down when you are
within 7 or so digits so that you won't go past the correct number.
After beating the monster in the safe, you can get a key, the Odin
materia, and the Cosmo Memory manual.