1. You need to get String from that StringBuilder.
2. Split string by white-space characters - either use
String.Split Method (Char[])[
^] or
Regex.Split Method (String, String)[
^] (in case of Regex you should use compiled regex stored in static readonly field).
3. Filter and count words using LINQ or "manually" in foreach block.
var sb = new StringBuilder("hi friends hi");
var text = sb.ToString();
var words = Regex.Split(text, @"\W");
var count = words.Where(i => i == "hi").Count();