Expose the end of the affected beam. If it is embedded in a wall, tear out the wall surrounding the rotted beam.
Use a chisel to remove the crumbly parts of the wood, which is anything that falls away easily.
Dry the affected area completely. If you live in an arid environment, you may be able to expose the end of the beam and let it dry naturally over a few days, or use a heater or blower to dry it artificially.
Treat the rot with an antiseptic solution such as carbolineum avenaiius or a commercial product specifically for the treatment of dry rot fungus. Allow the treatment to cure thoroughly. If the rot is extensive, drill holes into the wood and inject the treatment, or follow manufacturer's instructions.
Fill the area with an epoxy wood filler, spreading it into the cracks and openings with a chisel or trowel. If the area is deep, apply several layers, allowing adequate drying time (according to the epoxy instructions) between each application to prevent sagging.
Sand the epoxy once it is dry and paint with a good quality paint, or use a stained epoxy to match the wood tone of the beam you are repairing.