There have been many councils over the history of the early church that have set the canon (73 books, at least in the EO and Catholic Churches). What checklist or metric was used to determine what was and was not considered scripture?
There were two major schools of thought:
- Follow the Septuagint. This ~200 BC translation of the Hebrew scriptures into Greek includes the Deuterocanonical books. These books were included in the Vulgate translation by Jerome, and the Roman Catholic Church accepts this compilation.
- Follow the Masoretic Text. The Hebrew scriptures from the Masoretes, as preserved in (e.g.) the Aleppo (10th century) & Leningrad (11th century) Codices, do not include the Deuterocanonical books--this canon is also supported by Josephus (Against Apion 1.8). Most Protestant faiths accept this compilation.
There are a variety of other lists, but these two represent the two majority views. There are many arguments based on doctrinal congruity, quotes from early Christian Fathers, etc., which seek to show that either the Septuagint list or the Masoretic list is to be preferred.
Almost all Christian faiths accept the same 27 books of the New Testament (the Coptic Orthodox Church being a notable exception).
The criteria by which the New Testament books were delimited is summarized by Komoszewski, Sawyer, and Wallace:
Three key criteria were used to assess the authority of these books--apostolicity, orthodoxy, and catholicity. Was a book written by an apostle or an associate of an apostle (apostolicity?)? Did it conform to the teachings of other books known to be by apostles (orthodoxy)? Was it accepted early and by a majority of churches (catholicity)? Although the ancient church wrestled with a few of the books in light of these criteria, a substantial core was accepted quickly and without dispute. (Reinventing Jesus - How Contemporary Skeptics Miss the Real Jesus and Mislead Popular Culture p. 126)
The earliest extant list arguing for the 27 books accepted today--and only those 27 books--is the Easter Letter of Athanasius, written in AD 367, though it would be some time before all 27 (especially Revelation) were accepted by all the Christian churches.
The books that made it into the New Testament were already widely used in Christian churches when delimiting the canon became a major topic in the 4th century. A few texts, such as The Shepherd of Hermas, 1 Clement, and the Epistle of Barnabas, were widely used, but Christians were less certain that they were apostolic material. They ultimately did not make the cut in most Christian Bibles.
The Gnostic texts, as well as other known forgeries & pseudepigraphies, never came close to making it into the canon. There is much buzz about them in modern, skeptical circles, but the early Christian writers recognized they did not come from the apostles. For example, Irenaeus emphatically argues for Matthew, Mark, Luke, and John as the only 4 authoritative Gospels (Against Heresies 3.1.1) while blisteringly denouncing other "Gospels", such as the Gospel of Judas (ibid 1.31.1), as fakes.
Easy answer, it was what people read at Mass (or whatever they called it back then).
The pope and the North African bishops drew up their list from those books then in use by the Church, particularly those read at Mass. Finally, the list was submitted to Pope Boniface (Damasus’ successor) and the other bishops for confirmation.
There might be more to it than that, but the need to have a uniform Bible for liturgy is the most obvious answer. If you want to say there's an epistemology behind it, you might call it one of inclusivity. The NT was what was read at Mass, the OT was the Septuagint.
There's no magic reference to any subject in any particular book that makes it worthy of being in the Bible; except the OT entirely points to Jesus and the NT is the response of Faith.