Example 3 Let $f(x)=\frac{\sin ^{m} x}{a}+\frac{b}{\sin ^{n} x}\left(a, b, m, n \in \mathbf{N}^{*}\right), x \in(0, \pi)$, find the minimum value of $f(x)$.
(1) When $a b n \geqslant m$,
$$
\begin{aligned}
f(x) & =\frac{\sin ^{m} x}{a}+\frac{b}{\sin ^{n} x}=\frac{\sin ^{m} x}{a}+\left(\overbrace{\frac{1}{a \sin ^{n} x}+\frac{1}{a \sin ^{n} x}+\cdots+\frac{1}{a \sin ^{n} x}}^{a b \text { terms }}\right) \\
& \geqslant(a b+1) \sqrt{\frac{\sin ^{m} x}{a}\left(\frac{1}{a \sin ^{n} x}\right)^{a b}},
\end{aligned}
$$

Since $0<\sin x \leqslant 1$, we have $\frac{1}{\sin x} \geqslant 1$.
Also, $n a b-m \geqslant 0$, so $\left(\frac{1}{\sin x}\right)^{n a b-m} \geqslant 1$,
thus $f(x) \geqslant \frac{a b+1}{a}=b+\frac{1}{a}$, with equality when $\sin x=1$, i.e., $x=\frac{\pi}{2}$.
At this point, the minimum value of $f(x)$ is $\frac{1}{a}+b$.
(2) When $a b n<m$,
$$
\begin{array}{l}
\geqslant(m+n) \sqrt[m+n]{\left(\frac{\sin ^{m} x}{n a}\right)^{n} \cdot\left(\frac{b}{m \sin ^{n} x}\right)^{m}} \\
=(m+n) \cdot \sqrt[m+n]{\left(\frac{1}{n a}\right)^{n}\left(\frac{b}{m}\right)^{m}},
\end{array}
$$

with equality when $\frac{\sin ^{m} x}{n a}=\frac{b}{m \sin ^{n} x}$,
i.e., $x=\arcsin \sqrt[m+n]{\frac{n a b}{m}}$.
At this point, the minimum value of $f(x)$ is $(m+n) \sqrt[m+n]{\left(\frac{1}{n a}\right)^{n}\left(\frac{b}{m}\right)^{m}}$.
In summary, $f(x)_{\min }=\left\{\begin{array}{ll}\frac{1}{a}+b, & a b n \geqslant m \\ (m+n) \sqrt[m+n]{\left(\frac{1}{n a}\right)^{n}\left(\frac{b}{m}\right)^{m}}, \quad a b n<m\end{array}\right.$