I believe that shares of discount retailer Dollar General (DG -0.41%) are attractively priced for long-term investors right now. Therefore, I won't bury the lede: I think Dollar General stock is a good buy today.

I'll explain why I believe Dollar General stock is a good buy. But I'll also explain why some investors could rightly want to hold or sell their stakes.

The case for buying Dollar General stock

Through the first half of its fiscal 2023 (which ended Aug. 4), Dollar General's net income is down 20% from the same period of 2022. This sharp drop-off in profitability has resulted in the greatest pullback ever for Dollar General stock. It's currently down 51% from its all-time high. Therefore, now looks like a great time to buy.

DG Chart

DG data by YCharts

Don't get me wrong: Dollar General isn't out of the woods yet. Management's latest full-year financial guidance calls for a 29% to 34% year-over-year decline for its earnings per share (EPS) -- worsening from its drop in the first half of the year.

The market has lost all hope with Dollar General stock, as evidenced by its trading at a 10-year low price-to-sales (P/S) valuation of 0.7. But I believe the company can prove that the market is overreacting.

Dollar General is facing its challenges head-on. It may sound ironic, but the company's problems are fortunately self-inflicted -- self-inflicted concerns are more easily correctable than broader economy-based issues. The company returned previous CEO Todd Vasos to his former position, tasking him with fixing its issues with inventories and supply chain.

The path forward isn't rocket science. Dollar General's management has talked about overstocked shelves leading to elevated levels of theft. And too much inventory in the back has resulted in damaged merchandise. These things hurt profit margins and need to be dealt with.

Dealing with it means marking down prices to move inventory. This will also hit Dollar General's margins for a time.

The chart below shows that inventory growth outpacing revenue growth is a recent phenomenon for Dollar General. The out-of-control inventory also coincides with the decline in the company's profit margins.

DG Inventories (Quarterly) Chart

DG Inventories (Quarterly) data by YCharts

The good news for shareholders is that Dollar General is still growing revenue, it's still profitable, and its profits could start rebounding in 2024. When the profit rebound happens, this stock has plenty of upside, and that's why I believe it's a buy today.

The case for holding Dollar General stock

It's possible that I'm far too optimistic in my belief that Dollar General stock can turn things around. Consider that Vasos was the CEO until November 2022 before being restored this October. The company's issues were already starting during his previous leadership.

Also consider that some of Dollar General's losses come from theft -- a rising national problem. In 2022, there was a sharp 19% year-over-year increase in retail theft, according to Capital One Shopping Research. With Dollar General's cheaper merchandise, it could be harder to crack down on theft.

In short, Dollar General's problems could be fixable. But maybe investors want to see progress before buying more shares. After all, management's guidance does imply that profits will drop more sharply in the back half of fiscal 2023. In this case, investors might want to hold Dollar General stock, waiting and watching for improvements.

The case for selling Dollar General stock

To be clear, I believe that Dollar General stock is going to go back up because the business will recover. Therefore, I wouldn't sell under the assumption that things would get much worse.

Moreover, I believe downside is limited here, so I wouldn't sell for this reason either. Here's why: Even in this dismal year, management expects full-year EPS of at least $7.10. Dollar General stock trades at less than 18 times this year's expected earnings. That's cheaper than the average for the S&P 500. Even if this is the new normal for the company's profits, the stock is cheap.

However, there could be other reasons to sell a stock. For example, Dollar General stock isn't the only good bargain out there right now -- other companies face fixable problems or temporary headwinds as well. However, with over 19,000 locations already, some of Dollar General's highest growth is likely in the past. In contrast, there are some other companies with higher long-term upside.

For investors who have higher conviction in another company for these reasons, it could make sense to sell Dollar General stock and buy an alternative.

However, I hold Dollar General stock in my portfolio and will likely be adding to my position when the Motley Fool's disclosure rules allow. It's a longtime market-beating investment, the valuation is cheap, and I believe profits will make a dramatic comeback. For these reasons, I want to own more.