The Sagami Kokubun-ji (相模国分寺) is a Buddhist temple in the city of Ebina, Kanagawa, Japan. It is the provincial temple ("kokubunji") of former Sagami Province. The grounds of the temple are a National Historic Site. and its Kamakura period Bonshō is an Important Cultural Property. The temple was destroyed and rebuilt several times over its long history, and much of its documentary history has been lost. It now belongs to the Kōyasan Shingon-shū sect.
 The Shoku Nihongi records that in 741, as the country recovered from a major smallpox epidemic, Emperor Shōmu ordered that a monastery and nunnery be established in every province, the kokubunji (国分寺). These temples were built to a semi-standardized template, and served both to spread Buddhist orthodoxy to the provinces, and to emphasize the power of the Nara period centralized government under the Ritsuryō system.
 The origins of the Sagami Kokubun-ji are a mystery, as it is located a considerable distance from the provincial capital of Sagami, which was at Kōzu,  As the temple follows a layout patterned after Hōryū-ji, which predates the semi-standardized kokubunji format, it was long speculated that this was an existing temple which had been converted into a kokubunji. However, there is no archaeological evidence to support this hypothesis. Another theory was that the original kokubunji was located near Odawara, where a large ruined temple complex has been discovered. However, the roof tiles excavated from the Sagami Kokubun-ji site date from the middle of the 8th century, which corresponds to the construction period ordered by Emperor Shōmu. Another theory is that the temple was built at the original location of the provincial capital, which was later re-located. The Sagami Kokubun-ji and the Sagami ichinomiya are located in Kōza District, so it is possible that the Sagami provincial capital (whose exact location has not yet been positively identified) was also located in this area.
 Per ancient records, the temple was destroyed by a fire in 819, and suffered considerable damage and burned during again in 878 after a large earthquake. Per the Nihon Sandai Jitsuroku, it was rebuilt in 881 and it is mentioned in the Nihon Kiryaku in 940; however, there is no archaeological evidence indicating that it was actually rebuilt after the 878 earthquake, so it may have been relocated to another site which has yet to be discovered. The name reappears in the historical record in 1008, when it was listed in an inventory of the governor of Sagami Province, Taira no Takayoshi, and again in 1139, when Emperor Sutoku authorized it as a chokugan-ji to pray for the well-being of the nation. It was rebuilt in 1186 by Minamoto no Yoritomo and the Azuma Kagami records that Hōjō Masako sent a donation of horses in 1192 to pray for safe childbirth. After the Kamakura period, the temple disappears from history again for long periods, and by the start of the Edo period was reduced to a small Yakushi-dō chapel. This chapel was rebuilt in 1713, but was destroyed in a fire in 1910. This was rebuilt in 1910, 1974 and again in 1994.
 The current Sagami Kokubun-ji  has a Kondō, a guest hall, and a bell tower. According to the temple legend, the principal image Yakushi Nyorai attributed to Gyōki, but it is clearly a Muromachi period work. The only other import historical relic at the temple is its bell, with an engraving that it was donated by "Kokubun Jiro Minamoto no Yorisato" and is the work of Kunimitsu Mononobe. This Kunimitsu Mononobe is the same person to made the National Treasure bell at Engaku-ji in Kamakura. In 1921, the temple was the first kokubunji site to receive National Historic Site designation. The site was extensively excavated from 1986 to 1991, and again from 2003 to 2006, and its ruins are now maintained as a historic park.
 The ruins are located about 100 meters northwest of the current Sagami Kokubun-ji temple precincts. The original temple area is estimated to be 240 meters east-to-west and 300 meters north-to-south, with moats and an earthen rampart. It surrounded a cloister measuring 160 meters east-to-west and 120 meters north-to-south, with the central gate in the south, a Kondō on the east, and a Seven-Story Pagoda on the west. The Lecture Hall and the central gate are connected by a rectangular corridor, and on the north side of the Lecture Hall, a monk's residences and a group of buildings that are believed to have been responsible for the management and operation of the temple.
 The pagoda is estimated to have had a height of 65 meters, and a base of 107 meters on each side from the foundations. These foundations contained 16 large cornerstones of tuff, measuring several tons each, on a base of rammed earth and clay.
 The ruins of the provincial nunnery Sagami Kokubun-niji (相模国分尼寺) associated with the Sagami Kokubun-ji are located about 500 meters north of the ruins. As with the Sagami Kokubun-ji, the nunnery occupied a walled and moated compound 175 to 200 meters square. However, unlike the Sagami Kokubun-ji, the building were arranged in a straight line from south to north with a gate, Kondō and lecture hall connected by a stone-paved passage with a bell tower on the northwest side of the Kondō and a Kyōzō on the northeast side. A rectangular cloister connected the gate with the lecture hall. The Kondō originally had a based on rammed earth with foundation stones and a tiled roof; however, it later became a thatched-roof building with pillars set directly in the ground. The site was excavated from 1918 to 1920, and intermittently from 1988 onwards. It was declared a National Historic Site in 1997 with the area under protection expanded in 2008. It is preserved as part of the Sagami Kokubun-ji historic park.
 The two temples were originally connected by a canal, the remnants of which were discovered in 1949 and excavated in 1990.