It's perfectly fine. It will help break down the lignin and cellulose, and it will add phosphorous, potassium, sulfur and other nutrients that can be beneficial in a compost pile.
You need to know what kind of ash you are talking about. The ash in question is a product made by heating wood with the intent of separating the lignin from the cellulose. It has been called “wood ash” or “biosolids.
Wood ashes are commonly used as a soil amendment, but they may not be the best choice for garden compost. It’s possible to use wood ash as a soil conditioner, but not as a fertilizer. The wood ashes from a wood-burning stove are considered a waste product, and often end up in landfills or incinerators.
It is also one of the most effective ways to increase your compost temperature without using heat. When composting, it is important to keep the compost pile as hot as possible. If you don't have access to a wood stove or fireplace, a layer of ash in the center of your compost pile will help keep it hot.
Wood ash is a very good mulch material. It helps to maintain the soil's pH balance and retains moisture. Some gardeners use wood ash as fertilizer for their vegetable gardens, and some use it to help prevent weeds from growing in their lawns. Wood ash also makes a great soil amendment. You can spread it on your lawn or garden beds to keep your soil well-mulched and acidic.