Master Kaen is extremely difficult: he hits hard and often, casts clerical spells, and ignores Elbereth, making him incredibly ferocious in a straight-up fight. Among Kaen's few weaknesses are his covetous behavior and his lack of key resistances - specifically sleep resistance, drain resistance, and disintegration resistance. If you lack the means to take advantage of these, you can postpone the Quest until after you have finished the Castle. A luckstone and high Luck may be useful if you want to hit him in melee.
Thankfully, Master Kaen respects the scroll of scare monster, meaning that you only need to place one on the upstairs as soon as you arrive - this will leave him unable to do anything except possibly cast healing spells on himself. From there, you can finish him off however you please, using one of the other strategies listed further below in conjunction with the scroll; death rays should make short work of him, and the stronger attack wands (e.g. lightning, fire, or cold) will work nicely as well.
If he generates with the cloak of magic resistance, you can employ your martial arts and/or whatever weapons and projectiles you have available to bring him down; use F to ensure you stay on your square while attacking, and watch out for rays from a wand of fire that can burn the scroll of scare monster up from under you. Grand Master skill martial arts is your best bet to finish him quickly, and those not committed to weaponless may consider artifacts like Mjollnir.
If you lack a scroll of scare monster and have no other means of procuring one, the additional strategies discussed in the following sections can help ensure a relatively safe fight against Master Kaen.
The following information pertains to an upcoming version (NetHack 3.7.0). If this version is now released, please verify that it is still accurate, then update the page to incorporate this information.The scroll of scare monster no longer works on any @ or unique monster.
The spell of sleep is enough to render Kaen helpless if he does not have magic resistance, and it is one of the spells that a Monk may start the game with; a potion of sleeping will also suffice. Be prepared in case you miss (e.g. multiple potions), and be prepared to put him under again if he wakes up before you finish him off. Throwing a potion of paralysis or (preferably) attacking with a wielded potion while wearing a ring of free action is also viable.
Reading a noncursed scroll of earth—preferably blessed and on the upstair—will create a safe barrier around you that Master Kaen cannot cross, leaving you free to use any projectiles, spells or wands. As Kaen lacks long-range attacks, your main hazards will be the xorns and earth elementals that can phase through the rocks (though they both respect Elbereth). Attack wands used by other hostiles can fire past boulders easily, and a wand of striking can destroy boulders and leave an opening for Kaen - be careful not to push one out by accident!
Similarly, you can use fireproof water walking boots or levitate over the lava; you should have intrinsic fire resistance at this point from reaching XL 11, and should also fireproof your inventory as well. You can use ranged attacks and attack wands from this position, while preventing Kaen from reaching you and restricting him to the cure self and summon insects monster spells at that distance. Beware of any items or attacks that can compromise your ability to lava-walk or levitate, e.g. lightning destroying your ring of levitation!
Use the drain life spell until he croaks. It is a good idea to do this on the level above and when he teleports away (to heal the modest HP damage that drain life does on top of the draining effect), go downstairs to heal yourself, preferably on a burned Elbereth. Eidolos uses this method for his instructional ttyrec posted on RGRN; the ttyrec can be found here.
Even if Master Kaen generates with a cloak of magic resistance, he is not immune to disintegration. Controlled polymorphing into a black dragon and using #monster can kill him very quickly and easily, though his exceptionally low AC gives him a decent chance of dodging the first few breath attacks.
Whatever your form, your priority when using polyself should be to position yourself at the appropriate distance first (e.g. using the black dragon's flight to take advantage of the lava) before attacking with what ranged options you have. You can establish your boulder fort prior to changing forms, which trades preparation time and resources for much less risk.
If you elect not to pair this with unchanging, have a backup plan of escape or attack ready if you revert to normal form or are reduced to 0 HP while polymorphed—having a backup source of levitation that isn't affected by your polyself is recommended if you plan to use the lava as a defense.
Polymorphing Master Kaen
Master Kaen has no resistance against being polymorphed other than his low MR, so a couple of zaps from a wand of polymorph should suffice. Bashing him with a potion of polymorph may also work, but you'll want to have extras or a backup plan in case he resists the first. Whatever he transforms into will most likely be less dangerous than his original form, but there's a small chance of getting something like a titan or arch-lich that's a threat in its own right, and has enough MR to resist being polymorphed again.
If you use the wand, note that if Master Kaen hasn't awakened and picked up the Eyes yet, there's a 5% chance of them being polymorphed and destroyed. This can also happen if Master Kaen dies of system shock.
You can fight Kaen mano-a-mano if all else somehow fails - this is not recommended due to Master Kaen's AC and powerful base damage, though sufficiently advanced players have managed to defeat him this way. If you decide to go this route, make sure you have very high health, low AC, and half physical damage if at all possible.
In NetHack 3.4.3 and earlier versions, as well as some variants based on those versions, Master Kaen was not affected by the scroll of scare monster, and additionally gained magic resistance from carrying The Eyes of the Overworld, rendering most magic ineffective against him as soon as he picked it up.
Master Kaen's vulnerability to the scroll of scare monster was added in NetHack 3.6.0.
In SLASH'EM, where the Monk role originated, Monks have a much better chance against Master Kaen through liberal use of techniques: through combinations such as chi strike plus elemental fist plus pummel, you can even kill him in a single round of melee. A quaffed potion of invulnerability in particular can turn the fight into a cakewalk.
In EvilHack, Master Kaen does not respect the scroll of scare monster, and has a second 16d2 "claw" attack; it can knock the target back one or two squares much like the melee attacks of player and non-player Monks (including your quest leader and guardians). To make matters worse, a majority of the goal level is composed of lava, introducing the possibility of being sent flying into a certain doom if you are in the wrong place at the wrong time.
Master Kaen shares his encyclopedia entry with the monk.
One day, an army general invited the Buddhist monk I-Hsiu
(literally, "One Rest") to his military head office for a
dinner. I-Hsiu was not accustomed to wearing luxurious
clothings and so he just put on an old ordinary casual
robe to go to the military base. To him, "form is void".
As he approached the base, two soldiers appeared before him
and shouted, "Where does this beggar came from? Identify
yourself! You do not have permission to be around here!"
"My name is I-Hsiu Dharma Master. I am invited by your
general for a supper."
The two soldiers examined the monk closely and said, "You
liar. How come my general invites such a shabby monk to
dinner? He invites the very solemn venerable I-Hsiu to our
base for a great ceremony today, not you. Now, get out!"
I-Hsiu was unable to convince the soldiers that he was
indeed the invited guest, so he returned to the temple
and changed to a very formal solemn ceremonial robe for
the dinner. And as he returned to the military base, the
soldiers observed that he was such a great Buddhist monk,
let him in with honour.
At the dinner, I-Hsiu sat in front of the table full of
food but, instead of putting the food into his mouth, he
picked up the food with his chopsticks and put it into
his sleeves. The general was curious, and whispered to
him, "This is very embarrassing. Do you want to take
some food back to the temple? I will order the cook to
prepare some take out orders for you." "No" replied the
monk. "When I came here, I was not allowed into the
base by your soldiers until I wear this ceremonial robe.
You do not invite me for a dinner. You invite my robe.
Therefore, my robe is eating the food, not me."