A graph G is conflict-free k-edge-colorable if there exists an assignment of k colors to E(G) such that for every edge e∈E(G), there is a color that is assigned to exactly one edge among the closed neighborhood of e. The smallest k such that G is conflict-free k-edge-colorable is called the conflict-free chromatic index of G, denoted χCF′(G). Dȩbski and Przyby\a{l}o showed that 2≤χCF′(T)≤3 for every tree T of size at least two. In this paper, we present an algorithm to determine the conflict-free chromatic index of a tree without 2-degree vertices, in time O(∣V(T)∣). This partially answer a question raised by Kamyczura, Meszka and Przyby\a{l}o.