From How are big operators defined?, this makes the \ast occupy the same vertical footprint as \sum, which we know is well behaved.
I show two implementations, one that retains the \textstyle size always, and the other that grows in \displaystyle.
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\DeclareMathOperator*{\foo}{\scalerel*{\ast}{\sum}}
\DeclareMathOperator*{\barr}{\scalerel*{\ast}{\textstyle\sum}}
\usepackage{scalerel}
\begin{document}
[
\foo_{i=3}^{6}(f^2(i))
]
This is inline: (\foo_{i=3}^{6}(f^2(i)) )
[
\barr_{i=3}^{6}(f^2(i))
]
This is inline: (\barr_{i=3}^{6}(f^2(i)) )
\end{document}

\Hugebeing invalid in math mode. Please post a complete code. – campa Aug 04 '21 at 19:07