The question was asked:
Why was 2 Peter included in the New Testament in the 4th century when
its authorship was disputed for so long?
Most likely the early church hesitated to accept 2 Peter as authentic because so many other writings were floating around with Peter’s name on them there were clearly heretical.
Just like Peter was slow to accept converted Gentiles into the church, without laying on a bunch of ceremonial laws, so the early church was reluctant to accept 2 Peter as authentic. It was just easier for a time to throw out the baby (i.e. two epistles claiming to be from Peter) with the bath water (i.e. various gnostic writings that claimed the name of Peter).
Other posters deal with the internal form critical arguments against the letter being authentic and not forged. However, some of the best reasons for accepting it as authentic can be summarized in the acrostic “BAM.”
B stands for the body of the text. The body of the text appears to specifically state that it was written by Peter:
Simon Peter, a servant and apostle of Jesus Christ, To those who
through the righteousness of our God and Savior Jesus Christ... (2 Peter 1:1)
The Muratorian canon (2nd century) sets the qualifications for inclusion of books in the Biblical canon. To sure, it does not include Peter’s epistles in the list of books. However, as Westcort and others have noted, it is possible that the document is torn where they should have been listed.
Most importantly, the canon states how the names on the books need to be recognized as authentic and not forged. For example, certain books are rejected (emphasis added):
There is current also one to the Laodicenes, another to the
Alexandrians, [both] forged in Paul’s name to suit the heresy of
Marcion, and several others, which cannot be received into the
Catholic Church; for it is not fitting that gall be mixed with honey.
2 Peter was recognized by canonical by the Councils of Hippo and Carthage in the fourth century. The Muratorian principle of not allowing forgeries into the canon was followed in that both of those Councils rejected Barnabas and 1 Clement, because they were not of apostolic origin.
The example from Tertullian (On Baptism) of a defrocking of a presbyter for writing the Acts of Paul and Thecla is another example of the early church's disdain for allowing forgeries in the canon.
The second argument uses the word “A” for how its attribution to Peter was viewed positively by a lot of heavy hitters in the early church.
It is true that the attribution of authorship for the epistle was in dispute in the early church. The church leader, Eusebius in regards to 2 Peter said, "we have been taught to regard as uncanonical; many, however have thought it valuable, and have honored it with a place among the other scriptures." In another place he states:
And Peter, on whom the Church of Christ is built, 'against which the
gates of hell shall not prevail,' has left one acknowledged epistle;
perhaps also a second, but this is disputed. (HE 6.25.8)
However, having studied the reasoning behind Eusebius' doubts,
Jerome accepted 2 Peter as authentic in his epistle to the Hebidia (epistle 120). Jerome mentioned that some held doubts due to the linguistic differences between 1 and 2 Peter. However, he explained the difference by Peter’s usage of different scribes.
Regarding Origin, although he also recognized how some doubted its authenticity, he writes in his Homilies on Joshua (7:1) that “even Peter blows on the twin trumpets of his own Epistles.”
Daniel Wallace argues:
Irenaeus, however, does quote from it, and regards it as a genuine
work of Peter. From the last third of the second century on, this
letter is frequently regarded as Petrine, and is cited by Tertullian,
Clement of Alexandria, Theophilus of Antioch, etc. The Muratorian
Canon’s omission of either First or Second Peter can only be an
argument from silence, especially in light of the great probability of
there being a lacuna at this point in the fragment.
For specific examples that corroborate Wallace's assertion see this site.
The final argument starts with the letter “M” for mythical narratives are denounced in the text as something to be avoided in the Christian community. 2 Peter conveys a claim that the Gospel narratives were not meant to be taken as fictional accounts:
We did not follow cleverly invented stories (myths) when we told you
about the power of and coming of our Lord Jesus Christ, but we were
eyewitnesses of his majesty. (2 Peter 1:16)
From a form critical perspective, this is the type of argument that would be awkward if the work itself was a pious forgery. It would be like a big joke, that one got away with, to write what is recorded in 2 Peter 1:16 and have it be taken seriously by believers.
The non Christian 5th century philosopher, Macrobius, describes the devout pagans of his day. Evidently they liked to demythologize their religious stories and just looked at them as a type of parable of sorts. He writes:
Even if we regard the stories of Mopsus, Teiresias, Amphiraus,
Calchas, and Helenus as falsehoods of romantic fantasy (and if the
facts had been totally opposed, they would not have been incorporated
as seers into those legends), will we refuse to accept the divine
power as established even when we are enlightened by examples from
home?
Accepting 2 Peter as authentic and not a forgery is important, as it helps to support the interpretation that the early faith community did not cleverly invent stories in telling about the power and coming of Jesus. It was understood in the early church that the New Testament was composed by eyewitnesses or a close associates of the eyewitnesses of Jesus.