Near misses are an important type of accident precursor because they provide insights into failure-generating mechanisms, help understand safety risks, and guide necessary interventions before they develop into real accidents. A high occurrence frequency of near-miss incidents typically signals a warning of small safety margins. However, the occurrences of near-miss incidents are stochastic and serially dependent in nature. Ignoring these features will typically lead to a misunderstanding of a project's safety level. This paper presents a D-vine copula marginal regression model for count time series data. Incident counts are expressed as a function of predictors. A time-varying discrete marginal distribution is used to describe the uncertainty of incident occurrences at an arbitrary time point, while the dependence between consecutive observations at different time points is captured with copula functions. To allow for long-range and non-Gaussian dependences between incidents, the D-vine structure is used to build the multivariate copula function where the bivariate copula associated with each edge is not necessarily Gaussian. To avoid evaluating a large number of candidate models that use different marginals and bivariate copulas as building blocks, a greedy algorithm is proposed to estimate relevant parameters and select the best model. An information criterion is used to determine the tree level of the D-vine decomposition, which implies the Markov structure of the incident occurrences. The proposed method is applied to a set of near-miss count data collected from a construction project over 5 years. We show that the hidden dependence has a relatively large time-lag and is strongly non-Gaussian. Comparison with conventional methods shows that the proposed method is efficient and yields better predictive performance.