This is assuming you’ve already got a homebrew setup going and you’re producing your own beer.
Cannabis can be added to the beer at the same time the hops is added. THC is oil/alcohol soluble and some will dissolve in the brew as it ferments. Before adding it to the brew there are a few things you must do. Make sure the cannabis is dried until crispy. This removes all water molecules from it thus activating the THC. Soak the cannabis in cold water for several hours. This removes some of the water soluble tars and chlorophyll that are associated with that “plant” taste. General rule is one ounce shade leaves per gallon brew. Higher quality plant, use less cannabis.