The classification of arguments for God's existence into ontological, cosmological and teleological is due to Kant, and Kant had to group together arguments rather coarsely to fit the broad variety of them suggested by his time. Within each group multiple versions are distinguished today, and it is also not surprising that some arguments do not neatly fit into Kant's groups. Basically, ontological arguments are supposed to argue for the existence of God a priori from the definition of "God", while cosmological arguments argue for God as the first cause, and hence involve a posteriori elements concerning the nature and operation of causes. Avicenna's "proof of the truthful" happens to involve both aspects.
On the one hand, Avicenna proceeds from a "necessarily existent by virtue of itself", an entity that cannot not exist, which sounds similar to Anselm's starting point of "that, than which nothing greater can be conceived". On the other hand, the set of contingent things must have a cause that is not contingent, the reasoning goes, because otherwise it would be included in the set. This is similar to the traditional cosmological argument, but this way of putting it is parallel to Anselm's inference that "than which nothing greater" must already exist in reality because otherwise that same thing, which also exists in reality, would be greater (this type of reasoning is disallowed today because it leads to the Burali-Forti and Russell paradoxes). To complicate things further, Avicenna does not exactly make the "necessarily existent" into God by definition, instead he offers a series of ancillary arguments to derive its attributes, which ultimately allow him to identify it with the God of Islam.
The debate over the nature of Avicenna's argument is reviewed by Mayer in Ibn Sina's ‘Burhan Al-Siddiqin’. Given its heterogeneous nature taxonomic disagreement among scholars is to be expected. For example, Davidson writes in Proofs for Eternity:
"Avicenna does not regard the analysis of the concept necessarily existent by virtue of itself as sufficient to establish the actual existence of anything in the external world. He does not, in other words, wish to offer an a priori or ontological proof of the existence of God, but rather a new form of the cosmological proof".
Morewedge in "A Third Version of the Ontological Argument in the Ibn Sinian
Metaphysics" (p.188) says the exact opposite, and classes the argument along with "ontological proofs, which are based purely on his analytic specification of this concept". His reading is based on Avicenna's distinction between being and existence (not unlike Anselm's existence in mind and existence in reality). Avicenna's being "is more determinable and more extensive than both 'existence' and 'essence'", and so he can posit the the "necessarily existent" initially as only being, which then, due to "necessarily", must also be existent. Johnson in Ibn Sinā's Fourth Ontological Argument for God's Existence takes an intermediate position of classing the argument as cosmological overall, but containing an ontological aspect. Mayer's surmise shows that classification attempts are even more hopeless:
"So even if it is ruled that Ibn Sinā's argument is cosmological or ontological, it will remain to be answered which kind of cosmological or ontological argument it is. If it is an ontological proof, St. Anselm of Canterbury alone is now credited with two different versions. Then, if the proof is read as cosmological, William Lane Craig has shown that there are three subordinate types of cosmological argument: the kalām, the Thomist, and the later Leibnizian type. Arguments of the first type 'maintain the impossibility of an infinite temporal regress', those of the second 'maintain the impossibility of an infinite essentially ordered regress', and those of the third 'have no reference to an infinite regress at all'.
[...] Davidson (just quoted to the effect that Ibn Sinā's proof was definitely cosmological) claims that Ibn Sinā hit on an argument which could entirely dispense with reasoning from the absurdity of an infinite regress. This would mean that, in terms of Craig's typology, the shaykh had produced a cosmological argument directly foreshadowing the Leibnizian (or Spinozist) approach. However,
Davidson surprisingly finds that Ibn Sinā 'due to the influence upon him of other proofs of the existence of God illogically forced his own proof into the mould of familiar cosmological proofs that do explicitly reject an infinite regress of causes'".
It is noteworthy that the Burali-Forti paradox can also be equivalently presented as employing "infinite regress" (transfinite induction) or as a reductio that avoids its explicit use.