Yes, you can but personally I find it inconvenient to have to keep tabs on it and the last day your disembarkation would be possibly be delayed if you need to settle any balance due or refund. Refer to the following link for more info.
Top 10 Contributor
If you are going to use cash to pay for the on board credit, you will need to have enough to cover any shore excursions, tipping, drinks and any other purchases you make onboard the ship. If you don't have enough funds, your account will be closed and you will not be able to buy anything else on board until you add more funds.
I would suggest setting up the onboard account using your credit card and at the end of the trip settle your account with cash onboard the ship before you disembark. That way nothing will be billed to your credit card.
Number One Contributor