It's hard to find a lot of rules on the subject. I personally feel like both 'the' and 'method' should be stripped:
For intra-cluster relationships, we applied mathematical optimisation to choose the best tree produced by neighbour joining.
If neighbour joining is something that is unfamiliar to readers or if the method referred to is ambiguous (such as a one-word method that might be a common word), I would introduce the method beforehand, describing it as 'neighbour joining, a method characterized by...' then refer to it as 'neighbour joining' for the rest of the paper. Once people know the scope it would be less confusing.
It's purely speculation as I've never seen any rules on it. I personally think that just mentioning the method as in my blockquote above would be sufficient, but it would depend on the audience of the paper. If it was purely instructional, use 'the neighbour joining method' and describe what it is. If it's for a mathematically excellent audience, just 'neighbour joining' should work.
Using 'the' and 'rule' feels unnatural to me. Imagine people saying:
"To find the answer, we must first apply the L'Hôpital's Rule rule."
I know it's probably not helpful, as you probably need specifics for a journal or thesis. That's my 2 cents though; best of luck!